bhp-pro 1.2.2__py3-none-any.whl → 1.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.4.dist-info}/METADATA +1 -1
- bhp_pro-1.2.4.dist-info/RECORD +6 -0
- bhp_pro.py +226 -159
- bhp_pro-1.2.2.dist-info/RECORD +0 -6
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.4.dist-info}/WHEEL +0 -0
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.4.dist-info}/entry_points.txt +0 -0
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
bhp_pro.py,sha256=bgNV9jbwdNV3wtANUXO-5YDi7Qrv16LLO3LtWGumIOE,743939
|
|
2
|
+
bhp_pro-1.2.4.dist-info/METADATA,sha256=BznlzIpE7ds538WC90jCgjEsZiS58cbKVy72SrXxFGU,600
|
|
3
|
+
bhp_pro-1.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
bhp_pro-1.2.4.dist-info/entry_points.txt,sha256=Yn3HpraGX3lXX4FPq3Gm-lHh3SwQA-5rtgPWNWMFXkw,41
|
|
5
|
+
bhp_pro-1.2.4.dist-info/top_level.txt,sha256=1xjbIaVM77UJz9Tsi1JjILgE0YDG7iLhY6KSMNEi9zM,8
|
|
6
|
+
bhp_pro-1.2.4.dist-info/RECORD,,
|
bhp_pro.py
CHANGED
|
@@ -7818,40 +7818,34 @@ def open_port_checker():
|
|
|
7818
7818
|
def udp_tcp():
|
|
7819
7819
|
|
|
7820
7820
|
generate_ascii_banner("UDP", "TCP")
|
|
7821
|
-
|
|
7822
7821
|
import socket
|
|
7823
7822
|
import ssl
|
|
7824
7823
|
import os
|
|
7825
7824
|
import re
|
|
7826
7825
|
import requests
|
|
7827
|
-
import dns.resolver
|
|
7828
7826
|
import ipaddress
|
|
7829
7827
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
7830
7828
|
import time
|
|
7829
|
+
from tqdm import tqdm
|
|
7831
7830
|
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
TIMEOUT = 1.5 # Reduced timeout from 2 to 1.5 seconds
|
|
7835
|
-
MAX_THREADS = 100 # Increased thread pool size
|
|
7831
|
+
TIMEOUT = 1.5
|
|
7832
|
+
MAX_THREADS = 100
|
|
7836
7833
|
|
|
7837
|
-
# Optimized port list - focusing on most common ports first
|
|
7838
7834
|
COMMON_PORTS = [
|
|
7839
|
-
80, 443, 22, 21, 25, 53, 110, 143, 465, 587, 993, 995,
|
|
7840
|
-
3389, 3306, 5432, 27017, 1521, 1433,
|
|
7841
|
-
8080, 8443, 8888, 8000,
|
|
7842
|
-
161, 162, 137, 139, 445,
|
|
7843
|
-
23, 69, 123, 514,
|
|
7835
|
+
80, 443, 22, 21, 25, 53, 110, 143, 465, 587, 993, 995,
|
|
7836
|
+
3389, 3306, 5432, 27017, 1521, 1433,
|
|
7837
|
+
8080, 8443, 8888, 8000,
|
|
7838
|
+
161, 162, 137, 139, 445,
|
|
7839
|
+
23, 69, 123, 514,
|
|
7844
7840
|
]
|
|
7845
7841
|
|
|
7846
|
-
# Dictionary for common UDP ports with payloads (optimized for most common first)
|
|
7847
7842
|
common_ports_payloads = {
|
|
7848
|
-
53: b'\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\x01\x00\x01',
|
|
7849
|
-
123: b'\x1b' + 47 * b'\0',
|
|
7850
|
-
161: b'\x30\x26\x02\x01\x00\x04\x06public\xa0\x19\x02\x04\x13\x79\xf9\xa9\x02\x01\x00\x02\x01\x00\x30\x0b\x30\x09\x06\x05\x2b\x06\x01\x02\x01\x05\x00',
|
|
7851
|
-
137: b'\x82\x28\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x20\x43\x4B\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00\x00\x21\x00\x01',
|
|
7852
|
-
500: b'\x00' * 100,
|
|
7853
|
-
1900: b'M-SEARCH * HTTP/1.1\r\nHOST:239.255.255.250:1900\r\nMAN:"ssdp:discover"\r\nMX:1\r\nST:ssdp:all\r\n',
|
|
7854
|
-
# Removed less common UDP ports to speed up scanning
|
|
7843
|
+
53: b'\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\x01\x00\x01',
|
|
7844
|
+
123: b'\x1b' + 47 * b'\0',
|
|
7845
|
+
161: b'\x30\x26\x02\x01\x00\x04\x06public\xa0\x19\x02\x04\x13\x79\xf9\xa9\x02\x01\x00\x02\x01\x00\x30\x0b\x30\x09\x06\x05\x2b\x06\x01\x02\x01\x05\x00',
|
|
7846
|
+
137: b'\x82\x28\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x20\x43\x4B\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00\x00\x21\x00\x01',
|
|
7847
|
+
500: b'\x00' * 100,
|
|
7848
|
+
1900: b'M-SEARCH * HTTP/1.1\r\nHOST:239.255.255.250:1900\r\nMAN:"ssdp:discover"\r\nMX:1\r\nST:ssdp:all\r\n',
|
|
7855
7849
|
}
|
|
7856
7850
|
|
|
7857
7851
|
def send_udp_packet(ip, port, payload):
|
|
@@ -7860,96 +7854,99 @@ def udp_tcp():
|
|
|
7860
7854
|
try:
|
|
7861
7855
|
sock.sendto(payload, (ip, port))
|
|
7862
7856
|
data, _ = sock.recvfrom(1024)
|
|
7863
|
-
return data
|
|
7864
|
-
except
|
|
7865
|
-
return None
|
|
7857
|
+
return 'open', data
|
|
7858
|
+
except socket.timeout:
|
|
7859
|
+
return 'timeout', None
|
|
7860
|
+
except ConnectionResetError:
|
|
7861
|
+
return 'closed', None
|
|
7866
7862
|
except Exception as e:
|
|
7867
|
-
return None
|
|
7863
|
+
return 'error', None
|
|
7868
7864
|
|
|
7869
|
-
def
|
|
7865
|
+
def service_detection(ip, port, protocol='tcp'):
|
|
7870
7866
|
try:
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
return
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
return f"Banner: {banner[:100]}"
|
|
7920
|
-
|
|
7921
|
-
# UDP - optional but fragile (SNMP, NTP)
|
|
7922
|
-
elif port in [53, 161, 123, 500, 1900]:
|
|
7923
|
-
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
|
7924
|
-
s.settimeout(TIMEOUT)
|
|
7925
|
-
s.sendto(b'\x00', (ip, port))
|
|
7926
|
-
data, _ = s.recvfrom(1024)
|
|
7927
|
-
if data:
|
|
7928
|
-
return f"UDP Response: {data[:100]}"
|
|
7929
|
-
|
|
7930
|
-
# Generic TCP banner grabbing fallback
|
|
7931
|
-
elif port in COMMON_PORTS:
|
|
7932
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7933
|
-
s.settimeout(TIMEOUT)
|
|
7934
|
-
s.connect((ip, port))
|
|
7935
|
-
banner = s.recv(1024).decode(errors='ignore').strip()
|
|
7936
|
-
return f"TCP Banner: {banner[:100]}"
|
|
7937
|
-
|
|
7867
|
+
if protocol == 'tcp':
|
|
7868
|
+
if port == 80:
|
|
7869
|
+
response = requests.head(f'http://{ip}', timeout=TIMEOUT, allow_redirects=True)
|
|
7870
|
+
server = response.headers.get('Server', '').strip()
|
|
7871
|
+
if not server:
|
|
7872
|
+
return "HTTP Service"
|
|
7873
|
+
return f"HTTP: {server}"
|
|
7874
|
+
elif port == 443:
|
|
7875
|
+
response = requests.head(f'https://{ip}', timeout=TIMEOUT, verify=False, allow_redirects=True)
|
|
7876
|
+
server = response.headers.get('Server', '').strip()
|
|
7877
|
+
if not server:
|
|
7878
|
+
return "HTTPS Service"
|
|
7879
|
+
return f"HTTPS: {server}"
|
|
7880
|
+
elif port == 22:
|
|
7881
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7882
|
+
s.settimeout(TIMEOUT)
|
|
7883
|
+
s.connect((ip, port))
|
|
7884
|
+
banner = s.recv(1024).decode('utf-8', errors='ignore').strip()
|
|
7885
|
+
return f"SSH: {banner[:50]}"
|
|
7886
|
+
elif port in [21, 3306, 5432, 27017]:
|
|
7887
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7888
|
+
s.settimeout(TIMEOUT)
|
|
7889
|
+
s.connect((ip, port))
|
|
7890
|
+
banner = s.recv(1024).decode('utf-8', errors='ignore').strip()
|
|
7891
|
+
return f"{banner[:50]}"
|
|
7892
|
+
elif port in COMMON_PORTS:
|
|
7893
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7894
|
+
s.settimeout(TIMEOUT)
|
|
7895
|
+
s.connect((ip, port))
|
|
7896
|
+
banner = s.recv(1024).decode(errors='ignore').strip()
|
|
7897
|
+
return f"{banner[:50]}"
|
|
7898
|
+
|
|
7899
|
+
elif protocol == 'udp':
|
|
7900
|
+
if port == 53:
|
|
7901
|
+
return "DNS Service"
|
|
7902
|
+
elif port == 123:
|
|
7903
|
+
return "NTP Service"
|
|
7904
|
+
elif port == 161:
|
|
7905
|
+
return "SNMP Service"
|
|
7906
|
+
elif port == 137:
|
|
7907
|
+
return "NetBIOS Service"
|
|
7908
|
+
elif port == 500:
|
|
7909
|
+
return "ISAKMP Service"
|
|
7910
|
+
elif port == 1900:
|
|
7911
|
+
return "SSDP Service"
|
|
7912
|
+
else:
|
|
7913
|
+
return "UDP Service"
|
|
7914
|
+
|
|
7938
7915
|
except Exception:
|
|
7939
|
-
return "Service
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7916
|
+
return "Service"
|
|
7917
|
+
return "Service"
|
|
7918
|
+
|
|
7919
|
+
def categorize_port(port):
|
|
7920
|
+
port_categories = {
|
|
7921
|
+
'Web': [80, 443, 8080, 8443, 8888, 8000],
|
|
7922
|
+
'Email': [25, 110, 143, 465, 587, 993, 995],
|
|
7923
|
+
'SSH': [22, 3389],
|
|
7924
|
+
'Database': [3306, 5432, 27017, 1521, 1433],
|
|
7925
|
+
'DNS': [53],
|
|
7926
|
+
'Network': [161, 162, 137, 139, 445],
|
|
7927
|
+
'FTP': [21, 23, 69],
|
|
7928
|
+
'Time': [123],
|
|
7929
|
+
'VPN': [500],
|
|
7930
|
+
'Discovery': [1900],
|
|
7931
|
+
'Syslog': [514]
|
|
7932
|
+
}
|
|
7933
|
+
|
|
7934
|
+
for category, ports in port_categories.items():
|
|
7935
|
+
if port in ports:
|
|
7936
|
+
return category
|
|
7937
|
+
return "Other"
|
|
7943
7938
|
|
|
7944
|
-
def fast_tcp_scan(ip, ports,
|
|
7939
|
+
def fast_tcp_scan(ip, ports, stats, results_store):
|
|
7940
|
+
found_ports = []
|
|
7941
|
+
|
|
7945
7942
|
def check_port(ip, port):
|
|
7946
7943
|
try:
|
|
7947
7944
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7948
7945
|
s.settimeout(TIMEOUT)
|
|
7949
7946
|
result = s.connect_ex((ip, port))
|
|
7950
7947
|
if result == 0:
|
|
7951
|
-
service = service_detection(ip, port)
|
|
7952
|
-
return port,
|
|
7948
|
+
service = service_detection(ip, port, 'tcp')
|
|
7949
|
+
return port, service
|
|
7953
7950
|
except Exception:
|
|
7954
7951
|
pass
|
|
7955
7952
|
return None, None
|
|
@@ -7957,66 +7954,120 @@ def udp_tcp():
|
|
|
7957
7954
|
with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
|
|
7958
7955
|
futures = [executor.submit(check_port, ip, port) for port in ports]
|
|
7959
7956
|
for future in as_completed(futures):
|
|
7960
|
-
port,
|
|
7957
|
+
port, service = future.result()
|
|
7961
7958
|
if port:
|
|
7962
|
-
|
|
7959
|
+
stats['tcp'] += 1
|
|
7960
|
+
stats['total'] += 1
|
|
7961
|
+
category = categorize_port(port)
|
|
7962
|
+
found_ports.append((port, service, category))
|
|
7963
|
+
|
|
7964
|
+
results_store['tcp'].append(f"{ip}:{port} ({category}) - {service}")
|
|
7965
|
+
|
|
7966
|
+
return found_ports
|
|
7963
7967
|
|
|
7964
|
-
def fast_udp_scan(ip, ports,
|
|
7968
|
+
def fast_udp_scan(ip, ports, stats, results_store):
|
|
7969
|
+
found_ports = []
|
|
7970
|
+
|
|
7965
7971
|
def check_udp_port(ip, port):
|
|
7972
|
+
if port not in common_ports_payloads:
|
|
7973
|
+
return None, None
|
|
7974
|
+
|
|
7966
7975
|
payload = common_ports_payloads.get(port, b'')
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7976
|
+
status, data = send_udp_packet(ip, port, payload)
|
|
7977
|
+
|
|
7978
|
+
if status == 'open':
|
|
7979
|
+
service = service_detection(ip, port, 'udp')
|
|
7980
|
+
return port, service
|
|
7971
7981
|
return None, None
|
|
7972
7982
|
|
|
7983
|
+
udp_ports_to_scan = [port for port in ports if port in common_ports_payloads]
|
|
7984
|
+
|
|
7973
7985
|
with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
|
|
7974
|
-
futures = [executor.submit(check_udp_port, ip, port) for port in
|
|
7986
|
+
futures = [executor.submit(check_udp_port, ip, port) for port in udp_ports_to_scan]
|
|
7975
7987
|
for future in as_completed(futures):
|
|
7976
|
-
port,
|
|
7988
|
+
port, service = future.result()
|
|
7977
7989
|
if port:
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
# Scan TCP ports first (faster)
|
|
7985
|
-
fast_tcp_scan(ip, COMMON_PORTS, scan_results)
|
|
7990
|
+
stats['udp'] += 1
|
|
7991
|
+
stats['total'] += 1
|
|
7992
|
+
category = categorize_port(port)
|
|
7993
|
+
found_ports.append((port, service, category))
|
|
7994
|
+
|
|
7995
|
+
results_store['udp'].append(f"{ip}:{port} ({category}) - {service}")
|
|
7986
7996
|
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7997
|
+
return found_ports
|
|
7998
|
+
|
|
7999
|
+
def scan_target(ip, stats, results_store):
|
|
8000
|
+
tcp_ports = fast_tcp_scan(ip, COMMON_PORTS, stats, results_store)
|
|
8001
|
+
udp_ports = fast_udp_scan(ip, COMMON_PORTS, stats, results_store)
|
|
7990
8002
|
|
|
7991
|
-
|
|
7992
|
-
if
|
|
8003
|
+
ssl_cert = None
|
|
8004
|
+
if any(port[0] == 443 for port in tcp_ports):
|
|
7993
8005
|
try:
|
|
7994
8006
|
context = ssl.create_default_context()
|
|
7995
8007
|
with socket.create_connection((ip, 443), timeout=TIMEOUT) as sock:
|
|
7996
8008
|
with context.wrap_socket(sock, server_hostname=ip) as sslsock:
|
|
7997
8009
|
cert = sslsock.getpeercert()
|
|
7998
|
-
|
|
8010
|
+
ssl_cert = f"{ip}:443 - SSL Certificate: {cert.get('subject', '')}"
|
|
8011
|
+
results_store['ssl'].append(ssl_cert)
|
|
7999
8012
|
except Exception:
|
|
8000
8013
|
pass
|
|
8014
|
+
|
|
8015
|
+
return ip, tcp_ports, udp_ports, ssl_cert
|
|
8001
8016
|
|
|
8002
|
-
|
|
8017
|
+
def save_live_results(results_store, file_handle):
|
|
8018
|
+
if results_store['tcp']:
|
|
8019
|
+
for result in results_store['tcp']:
|
|
8020
|
+
file_handle.write(f"[TCP] {result}\n")
|
|
8021
|
+
results_store['tcp'].clear()
|
|
8022
|
+
|
|
8023
|
+
if results_store['udp']:
|
|
8024
|
+
for result in results_store['udp']:
|
|
8025
|
+
file_handle.write(f"[UDP] {result}\n")
|
|
8026
|
+
results_store['udp'].clear()
|
|
8027
|
+
|
|
8028
|
+
if results_store['ssl']:
|
|
8029
|
+
for result in results_store['ssl']:
|
|
8030
|
+
file_handle.write(f"[SSL] {result}\n")
|
|
8031
|
+
results_store['ssl'].clear()
|
|
8032
|
+
|
|
8033
|
+
file_handle.flush()
|
|
8003
8034
|
|
|
8004
|
-
def batch_scan(targets):
|
|
8035
|
+
def batch_scan(targets, stats, filepath):
|
|
8005
8036
|
all_results = {}
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8037
|
+
results_store = {'tcp': [], 'udp': [], 'ssl': []}
|
|
8038
|
+
|
|
8039
|
+
with open(filepath, "w") as f:
|
|
8040
|
+
f.write(f"PORT SCAN RESULTS - Live Feed\n")
|
|
8041
|
+
f.write(f"Started: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
8042
|
+
f.write("=" * 60 + "\n\n")
|
|
8043
|
+
f.flush()
|
|
8044
|
+
|
|
8045
|
+
# Simple fast progress bar - update only when targets complete
|
|
8046
|
+
with tqdm(total=len(targets), desc="Scanning", unit="target") as pbar:
|
|
8047
|
+
with ThreadPoolExecutor(max_workers=100) as executor:
|
|
8048
|
+
future_to_ip = {executor.submit(scan_target, ip, stats, results_store): ip for ip in targets}
|
|
8049
|
+
for future in as_completed(future_to_ip):
|
|
8050
|
+
ip = future_to_ip[future]
|
|
8051
|
+
try:
|
|
8052
|
+
ip_result, tcp_ports, udp_ports, ssl_cert = future.result()
|
|
8053
|
+
if tcp_ports or udp_ports:
|
|
8054
|
+
all_results[ip_result] = (tcp_ports, udp_ports, ssl_cert)
|
|
8055
|
+
except Exception:
|
|
8056
|
+
pass
|
|
8057
|
+
|
|
8058
|
+
pbar.update(1)
|
|
8059
|
+
pbar.set_description(f"TCP: {stats['tcp']} UDP: {stats['udp']}")
|
|
8060
|
+
|
|
8061
|
+
# Save results after each target completes
|
|
8062
|
+
save_live_results(results_store, f)
|
|
8063
|
+
|
|
8064
|
+
f.write("\n" + "=" * 60 + "\n")
|
|
8065
|
+
f.write(f"SCAN COMPLETE\n")
|
|
8066
|
+
f.write(f"Total TCP: {stats['tcp']} | Total UDP: {stats['udp']} | Total: {stats['total']}\n")
|
|
8067
|
+
f.write(f"Ended: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
8068
|
+
|
|
8016
8069
|
return all_results
|
|
8017
8070
|
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
8071
|
def get_targets_from_input(input_str):
|
|
8021
8072
|
targets = set()
|
|
8022
8073
|
try:
|
|
@@ -8026,29 +8077,21 @@ def udp_tcp():
|
|
|
8026
8077
|
for line in lines:
|
|
8027
8078
|
line = line.strip()
|
|
8028
8079
|
targets.update(get_targets_from_input(line))
|
|
8029
|
-
elif "/" in input_str:
|
|
8080
|
+
elif "/" in input_str:
|
|
8030
8081
|
net = ipaddress.ip_network(input_str, strict=False)
|
|
8031
8082
|
targets.update(str(ip) for ip in net.hosts())
|
|
8032
|
-
elif re.match(r"^\d{1,3}(\.\d{1,3}){3}$", input_str):
|
|
8083
|
+
elif re.match(r"^\d{1,3}(\.\d{1,3}){3}$", input_str):
|
|
8033
8084
|
targets.add(input_str)
|
|
8034
|
-
else:
|
|
8085
|
+
else:
|
|
8035
8086
|
try:
|
|
8036
8087
|
ip = socket.gethostbyname(input_str)
|
|
8037
8088
|
targets.add(ip)
|
|
8038
8089
|
except:
|
|
8039
|
-
print(f"Failed to resolve
|
|
8040
|
-
except Exception
|
|
8041
|
-
print(
|
|
8090
|
+
print(f"Failed to resolve: {input_str}")
|
|
8091
|
+
except Exception:
|
|
8092
|
+
print("Error processing input")
|
|
8042
8093
|
return list(targets)
|
|
8043
8094
|
|
|
8044
|
-
def save_results_to_file(results):
|
|
8045
|
-
with open(SAVE_FILE, "w") as f:
|
|
8046
|
-
for ip, ports in results.items():
|
|
8047
|
-
f.write(f"\n[+] {ip}\n")
|
|
8048
|
-
for port, info in ports.items():
|
|
8049
|
-
f.write(f" {port}: {info}\n")
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
8095
|
def udp_tcp_main098():
|
|
8053
8096
|
user_input = input("Enter IP/URL/CIDR or file path: ")
|
|
8054
8097
|
targets = get_targets_from_input(user_input)
|
|
@@ -8057,13 +8100,34 @@ def udp_tcp():
|
|
|
8057
8100
|
print("No valid targets found.")
|
|
8058
8101
|
return
|
|
8059
8102
|
|
|
8103
|
+
output_file = input("Enter output filename (e.g., results.txt): ").strip()
|
|
8104
|
+
if not output_file:
|
|
8105
|
+
output_file = "scan_results.txt"
|
|
8106
|
+
|
|
8107
|
+
if not output_file.endswith('.txt'):
|
|
8108
|
+
output_file += '.txt'
|
|
8109
|
+
|
|
8110
|
+
cwd = os.getcwd()
|
|
8111
|
+
filepath = os.path.join(cwd, output_file)
|
|
8112
|
+
|
|
8113
|
+
print(f"\nStarting scan of {len(targets)} target(s)...")
|
|
8114
|
+
print(f"Live results saving to: {filepath}")
|
|
8115
|
+
print("-" * 60)
|
|
8116
|
+
|
|
8117
|
+
stats = {'tcp': 0, 'udp': 0, 'total': 0}
|
|
8060
8118
|
start_time = time.time()
|
|
8061
|
-
|
|
8119
|
+
|
|
8120
|
+
all_results = batch_scan(targets, stats, filepath)
|
|
8121
|
+
|
|
8062
8122
|
elapsed = time.time() - start_time
|
|
8063
8123
|
|
|
8064
|
-
|
|
8065
|
-
print(f"
|
|
8066
|
-
print(f"
|
|
8124
|
+
print(f"\n" + "-" * 60)
|
|
8125
|
+
print(f"Scan completed in {elapsed:.2f} seconds")
|
|
8126
|
+
print(f"TCP: {stats['tcp']} | UDP: {stats['udp']} | Total: {stats['total']}")
|
|
8127
|
+
print(f"Results saved to: {filepath}")
|
|
8128
|
+
|
|
8129
|
+
if stats['total'] == 0:
|
|
8130
|
+
print("No open ports found.")
|
|
8067
8131
|
|
|
8068
8132
|
udp_tcp_main098()
|
|
8069
8133
|
|
|
@@ -13374,6 +13438,7 @@ def update():
|
|
|
13374
13438
|
|
|
13375
13439
|
import subprocess
|
|
13376
13440
|
import sys
|
|
13441
|
+
import time
|
|
13377
13442
|
|
|
13378
13443
|
def run_pip_command(command):
|
|
13379
13444
|
"""Run a pip command and return the result."""
|
|
@@ -13416,12 +13481,14 @@ def update():
|
|
|
13416
13481
|
else:
|
|
13417
13482
|
print(f"Installation/update of {package_name} failed.")
|
|
13418
13483
|
sys.exit(1)
|
|
13484
|
+
|
|
13485
|
+
# Optional: Brief pause to see output before exiting
|
|
13486
|
+
time.sleep(2)
|
|
13487
|
+
|
|
13488
|
+
# Exit successfully
|
|
13489
|
+
sys.exit(0)
|
|
13419
13490
|
|
|
13420
13491
|
mainfire()
|
|
13421
|
-
time.sleep(1)
|
|
13422
|
-
randomshit(return_message)
|
|
13423
|
-
input()
|
|
13424
|
-
sys.exit
|
|
13425
13492
|
|
|
13426
13493
|
def update00():
|
|
13427
13494
|
|
|
@@ -16876,7 +16943,7 @@ def banner():
|
|
|
16876
16943
|
MAGENTA + "██╔═══╝ ██╔══██╗██║ ██║" + LIME + "user should understand that useage of this script may be" + ENDC,
|
|
16877
16944
|
MAGENTA + "██║ ██║ ██║╚██████╔╝" + LIME + "concidered an attack on a data network, and may violate terms" + ENDC,
|
|
16878
16945
|
MAGENTA + "╚═╝ ╚═╝ ╚═╝ ╚═════╝" + LIME + "of service, use on your own network or get permission first" + ENDC,
|
|
16879
|
-
PURPLE + "script_version@ 1.2.
|
|
16946
|
+
PURPLE + "script_version@ 1.2.4 ®" + ENDC,
|
|
16880
16947
|
ORANGE + "All rights reserved 2022-2025 ♛: ®" + ENDC,
|
|
16881
16948
|
MAGENTA + "In Collaboration whit Ayan Rajpoot ® " + ENDC,
|
|
16882
16949
|
BLUE + "Support: https://t.me/BugScanX 💬" + ENDC,
|
bhp_pro-1.2.2.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
bhp_pro.py,sha256=ffczA1rUc3B6RfEVLFDHMwTRLfAbKX3rjYwHFuUtU2E,741124
|
|
2
|
-
bhp_pro-1.2.2.dist-info/METADATA,sha256=J8ckwZ92dhcVHH6iW-Ob9RphX-f_Z5zR7IwfGuLbefA,600
|
|
3
|
-
bhp_pro-1.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
-
bhp_pro-1.2.2.dist-info/entry_points.txt,sha256=Yn3HpraGX3lXX4FPq3Gm-lHh3SwQA-5rtgPWNWMFXkw,41
|
|
5
|
-
bhp_pro-1.2.2.dist-info/top_level.txt,sha256=1xjbIaVM77UJz9Tsi1JjILgE0YDG7iLhY6KSMNEi9zM,8
|
|
6
|
-
bhp_pro-1.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|