bhp-pro 1.2.2__py3-none-any.whl → 1.2.3__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.3.dist-info}/METADATA +1 -1
- bhp_pro-1.2.3.dist-info/RECORD +6 -0
- bhp_pro.py +227 -153
- bhp_pro-1.2.2.dist-info/RECORD +0 -6
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.3.dist-info}/WHEEL +0 -0
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.3.dist-info}/entry_points.txt +0 -0
- {bhp_pro-1.2.2.dist-info → bhp_pro-1.2.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
bhp_pro.py,sha256=rF2jOsRh8wscEdzWp9kKFNtX4SItwfh99oy9R80iN0Q,744358
|
|
2
|
+
bhp_pro-1.2.3.dist-info/METADATA,sha256=QRATsusWg7bRojFoFOe774rXyUbf0cerWwY_Ejo591w,600
|
|
3
|
+
bhp_pro-1.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
bhp_pro-1.2.3.dist-info/entry_points.txt,sha256=Yn3HpraGX3lXX4FPq3Gm-lHh3SwQA-5rtgPWNWMFXkw,41
|
|
5
|
+
bhp_pro-1.2.3.dist-info/top_level.txt,sha256=1xjbIaVM77UJz9Tsi1JjILgE0YDG7iLhY6KSMNEi9zM,8
|
|
6
|
+
bhp_pro-1.2.3.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,104 @@ def udp_tcp():
|
|
|
7860
7854
|
try:
|
|
7861
7855
|
sock.sendto(payload, (ip, port))
|
|
7862
7856
|
data, _ = sock.recvfrom(1024)
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7857
|
+
# Got actual UDP response (port is open)
|
|
7858
|
+
return 'open', data
|
|
7859
|
+
except socket.timeout:
|
|
7860
|
+
# No response (port might be open/filtered)
|
|
7861
|
+
# UDP scanning limitation: can't distinguish open vs filtered
|
|
7862
|
+
return 'timeout', None
|
|
7863
|
+
except ConnectionResetError:
|
|
7864
|
+
# ICMP port unreachable (port is closed)
|
|
7865
|
+
return 'closed', None
|
|
7866
7866
|
except Exception as e:
|
|
7867
|
-
|
|
7867
|
+
# Other error
|
|
7868
|
+
return 'error', None
|
|
7868
7869
|
|
|
7869
|
-
def
|
|
7870
|
+
def service_detection(ip, port, protocol='tcp'):
|
|
7870
7871
|
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
|
-
|
|
7872
|
+
if protocol == 'tcp':
|
|
7873
|
+
if port == 80:
|
|
7874
|
+
response = requests.head(f'http://{ip}', timeout=TIMEOUT, allow_redirects=True)
|
|
7875
|
+
server = response.headers.get('Server', '').strip()
|
|
7876
|
+
if not server:
|
|
7877
|
+
return "HTTP Service"
|
|
7878
|
+
return f"HTTP: {server}"
|
|
7879
|
+
elif port == 443:
|
|
7880
|
+
response = requests.head(f'https://{ip}', timeout=TIMEOUT, verify=False, allow_redirects=True)
|
|
7881
|
+
server = response.headers.get('Server', '').strip()
|
|
7882
|
+
if not server:
|
|
7883
|
+
return "HTTPS Service"
|
|
7884
|
+
return f"HTTPS: {server}"
|
|
7885
|
+
elif port == 22:
|
|
7886
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7887
|
+
s.settimeout(TIMEOUT)
|
|
7888
|
+
s.connect((ip, port))
|
|
7889
|
+
banner = s.recv(1024).decode('utf-8', errors='ignore').strip()
|
|
7890
|
+
return f"SSH: {banner[:50]}"
|
|
7891
|
+
elif port in [21, 3306, 5432, 27017]:
|
|
7892
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7893
|
+
s.settimeout(TIMEOUT)
|
|
7894
|
+
s.connect((ip, port))
|
|
7895
|
+
banner = s.recv(1024).decode('utf-8', errors='ignore').strip()
|
|
7896
|
+
return f"{banner[:50]}"
|
|
7897
|
+
elif port in COMMON_PORTS:
|
|
7898
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7899
|
+
s.settimeout(TIMEOUT)
|
|
7900
|
+
s.connect((ip, port))
|
|
7901
|
+
banner = s.recv(1024).decode(errors='ignore').strip()
|
|
7902
|
+
return f"{banner[:50]}"
|
|
7903
|
+
|
|
7904
|
+
elif protocol == 'udp':
|
|
7905
|
+
if port == 53:
|
|
7906
|
+
return "DNS Service"
|
|
7907
|
+
elif port == 123:
|
|
7908
|
+
return "NTP Service"
|
|
7909
|
+
elif port == 161:
|
|
7910
|
+
return "SNMP Service"
|
|
7911
|
+
elif port == 137:
|
|
7912
|
+
return "NetBIOS Service"
|
|
7913
|
+
elif port == 500:
|
|
7914
|
+
return "ISAKMP Service"
|
|
7915
|
+
elif port == 1900:
|
|
7916
|
+
return "SSDP Service"
|
|
7917
|
+
else:
|
|
7918
|
+
return "UDP Service"
|
|
7919
|
+
|
|
7938
7920
|
except Exception:
|
|
7939
|
-
return "Service
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7921
|
+
return "Service"
|
|
7922
|
+
return "Service"
|
|
7923
|
+
|
|
7924
|
+
def categorize_port(port):
|
|
7925
|
+
port_categories = {
|
|
7926
|
+
'Web': [80, 443, 8080, 8443, 8888, 8000],
|
|
7927
|
+
'Email': [25, 110, 143, 465, 587, 993, 995],
|
|
7928
|
+
'SSH': [22, 3389],
|
|
7929
|
+
'Database': [3306, 5432, 27017, 1521, 1433],
|
|
7930
|
+
'DNS': [53],
|
|
7931
|
+
'Network': [161, 162, 137, 139, 445],
|
|
7932
|
+
'FTP': [21, 23, 69],
|
|
7933
|
+
'Time': [123],
|
|
7934
|
+
'VPN': [500],
|
|
7935
|
+
'Discovery': [1900],
|
|
7936
|
+
'Syslog': [514]
|
|
7937
|
+
}
|
|
7938
|
+
|
|
7939
|
+
for category, ports in port_categories.items():
|
|
7940
|
+
if port in ports:
|
|
7941
|
+
return category
|
|
7942
|
+
return "Other"
|
|
7943
7943
|
|
|
7944
|
-
def fast_tcp_scan(ip, ports,
|
|
7944
|
+
def fast_tcp_scan(ip, ports, stats, pbar, results_store):
|
|
7945
|
+
found_ports = []
|
|
7946
|
+
|
|
7945
7947
|
def check_port(ip, port):
|
|
7946
7948
|
try:
|
|
7947
7949
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
7948
7950
|
s.settimeout(TIMEOUT)
|
|
7949
7951
|
result = s.connect_ex((ip, port))
|
|
7950
7952
|
if result == 0:
|
|
7951
|
-
service = service_detection(ip, port)
|
|
7952
|
-
return port,
|
|
7953
|
+
service = service_detection(ip, port, 'tcp')
|
|
7954
|
+
return port, service
|
|
7953
7955
|
except Exception:
|
|
7954
7956
|
pass
|
|
7955
7957
|
return None, None
|
|
@@ -7957,66 +7959,125 @@ def udp_tcp():
|
|
|
7957
7959
|
with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
|
|
7958
7960
|
futures = [executor.submit(check_port, ip, port) for port in ports]
|
|
7959
7961
|
for future in as_completed(futures):
|
|
7960
|
-
port,
|
|
7962
|
+
port, service = future.result()
|
|
7961
7963
|
if port:
|
|
7962
|
-
|
|
7964
|
+
stats['tcp'] += 1
|
|
7965
|
+
stats['total'] += 1
|
|
7966
|
+
category = categorize_port(port)
|
|
7967
|
+
found_ports.append((port, service, category))
|
|
7968
|
+
|
|
7969
|
+
results_store['tcp'].append(f"{ip}:{port} ({category}) - {service}")
|
|
7970
|
+
|
|
7971
|
+
if pbar:
|
|
7972
|
+
pbar.set_description(f"TCP: {stats['tcp']} UDP: {stats['udp']}")
|
|
7973
|
+
|
|
7974
|
+
return found_ports
|
|
7963
7975
|
|
|
7964
|
-
def fast_udp_scan(ip, ports,
|
|
7976
|
+
def fast_udp_scan(ip, ports, stats, pbar, results_store):
|
|
7977
|
+
found_ports = []
|
|
7978
|
+
|
|
7965
7979
|
def check_udp_port(ip, port):
|
|
7980
|
+
if port not in common_ports_payloads:
|
|
7981
|
+
return None, None
|
|
7982
|
+
|
|
7966
7983
|
payload = common_ports_payloads.get(port, b'')
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7984
|
+
status, data = send_udp_packet(ip, port, payload)
|
|
7985
|
+
|
|
7986
|
+
# Only count as open if we got actual UDP response
|
|
7987
|
+
if status == 'open':
|
|
7988
|
+
service = service_detection(ip, port, 'udp')
|
|
7989
|
+
return port, service
|
|
7971
7990
|
return None, None
|
|
7972
7991
|
|
|
7973
7992
|
with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
|
|
7974
7993
|
futures = [executor.submit(check_udp_port, ip, port) for port in ports if port in common_ports_payloads]
|
|
7975
7994
|
for future in as_completed(futures):
|
|
7976
|
-
port,
|
|
7995
|
+
port, service = future.result()
|
|
7977
7996
|
if port:
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7997
|
+
stats['udp'] += 1
|
|
7998
|
+
stats['total'] += 1
|
|
7999
|
+
category = categorize_port(port)
|
|
8000
|
+
found_ports.append((port, service, category))
|
|
8001
|
+
|
|
8002
|
+
results_store['udp'].append(f"{ip}:{port} ({category}) - {service}")
|
|
8003
|
+
|
|
8004
|
+
if pbar:
|
|
8005
|
+
pbar.set_description(f"TCP: {stats['tcp']} UDP: {stats['udp']}")
|
|
7983
8006
|
|
|
7984
|
-
|
|
7985
|
-
|
|
8007
|
+
return found_ports
|
|
8008
|
+
|
|
8009
|
+
def scan_target(ip, stats, pbar, results_store):
|
|
8010
|
+
if pbar:
|
|
8011
|
+
pbar.set_description(f"Scanning {ip}")
|
|
7986
8012
|
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
fast_udp_scan(ip, COMMON_PORTS, scan_results)
|
|
8013
|
+
tcp_ports = fast_tcp_scan(ip, COMMON_PORTS, stats, pbar, results_store)
|
|
8014
|
+
udp_ports = fast_udp_scan(ip, COMMON_PORTS, stats, pbar, results_store)
|
|
7990
8015
|
|
|
7991
|
-
|
|
7992
|
-
if
|
|
8016
|
+
ssl_cert = None
|
|
8017
|
+
if any(port[0] == 443 for port in tcp_ports):
|
|
7993
8018
|
try:
|
|
7994
8019
|
context = ssl.create_default_context()
|
|
7995
8020
|
with socket.create_connection((ip, 443), timeout=TIMEOUT) as sock:
|
|
7996
8021
|
with context.wrap_socket(sock, server_hostname=ip) as sslsock:
|
|
7997
8022
|
cert = sslsock.getpeercert()
|
|
7998
|
-
|
|
8023
|
+
ssl_cert = f"{ip}:443 - SSL Certificate: {cert.get('subject', '')}"
|
|
8024
|
+
results_store['ssl'].append(ssl_cert)
|
|
7999
8025
|
except Exception:
|
|
8000
8026
|
pass
|
|
8027
|
+
|
|
8028
|
+
return ip, tcp_ports, udp_ports, ssl_cert
|
|
8001
8029
|
|
|
8002
|
-
|
|
8030
|
+
def save_live_results(results_store, file_handle):
|
|
8031
|
+
if results_store['tcp']:
|
|
8032
|
+
for result in results_store['tcp']:
|
|
8033
|
+
file_handle.write(f"[TCP] {result}\n")
|
|
8034
|
+
results_store['tcp'].clear()
|
|
8035
|
+
|
|
8036
|
+
if results_store['udp']:
|
|
8037
|
+
for result in results_store['udp']:
|
|
8038
|
+
file_handle.write(f"[UDP] {result}\n")
|
|
8039
|
+
results_store['udp'].clear()
|
|
8040
|
+
|
|
8041
|
+
if results_store['ssl']:
|
|
8042
|
+
for result in results_store['ssl']:
|
|
8043
|
+
file_handle.write(f"[SSL] {result}\n")
|
|
8044
|
+
results_store['ssl'].clear()
|
|
8045
|
+
|
|
8046
|
+
file_handle.flush()
|
|
8003
8047
|
|
|
8004
|
-
def batch_scan(targets):
|
|
8048
|
+
def batch_scan(targets, stats, filepath):
|
|
8005
8049
|
all_results = {}
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8050
|
+
results_store = {'tcp': [], 'udp': [], 'ssl': []}
|
|
8051
|
+
|
|
8052
|
+
with open(filepath, "w") as f:
|
|
8053
|
+
f.write(f"PORT SCAN RESULTS - Live Feed\n")
|
|
8054
|
+
f.write(f"Started: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
8055
|
+
f.write("=" * 60 + "\n\n")
|
|
8056
|
+
f.flush()
|
|
8057
|
+
|
|
8058
|
+
with tqdm(total=len(targets), desc="Scanning targets", unit="target") as pbar:
|
|
8059
|
+
with ThreadPoolExecutor(max_workers=100) as executor:
|
|
8060
|
+
future_to_ip = {executor.submit(scan_target, ip, stats, pbar, results_store): ip for ip in targets}
|
|
8061
|
+
for future in as_completed(future_to_ip):
|
|
8062
|
+
ip = future_to_ip[future]
|
|
8063
|
+
try:
|
|
8064
|
+
ip_result, tcp_ports, udp_ports, ssl_cert = future.result()
|
|
8065
|
+
if tcp_ports or udp_ports:
|
|
8066
|
+
all_results[ip_result] = (tcp_ports, udp_ports, ssl_cert)
|
|
8067
|
+
except Exception:
|
|
8068
|
+
pass
|
|
8069
|
+
pbar.update(1)
|
|
8070
|
+
pbar.set_description(f"TCP: {stats['tcp']} UDP: {stats['udp']}")
|
|
8071
|
+
|
|
8072
|
+
save_live_results(results_store, f)
|
|
8073
|
+
|
|
8074
|
+
f.write("\n" + "=" * 60 + "\n")
|
|
8075
|
+
f.write(f"SCAN COMPLETE\n")
|
|
8076
|
+
f.write(f"Total TCP: {stats['tcp']} | Total UDP: {stats['udp']} | Total: {stats['total']}\n")
|
|
8077
|
+
f.write(f"Ended: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
8078
|
+
|
|
8016
8079
|
return all_results
|
|
8017
8080
|
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
8081
|
def get_targets_from_input(input_str):
|
|
8021
8082
|
targets = set()
|
|
8022
8083
|
try:
|
|
@@ -8026,29 +8087,21 @@ def udp_tcp():
|
|
|
8026
8087
|
for line in lines:
|
|
8027
8088
|
line = line.strip()
|
|
8028
8089
|
targets.update(get_targets_from_input(line))
|
|
8029
|
-
elif "/" in input_str:
|
|
8090
|
+
elif "/" in input_str:
|
|
8030
8091
|
net = ipaddress.ip_network(input_str, strict=False)
|
|
8031
8092
|
targets.update(str(ip) for ip in net.hosts())
|
|
8032
|
-
elif re.match(r"^\d{1,3}(\.\d{1,3}){3}$", input_str):
|
|
8093
|
+
elif re.match(r"^\d{1,3}(\.\d{1,3}){3}$", input_str):
|
|
8033
8094
|
targets.add(input_str)
|
|
8034
|
-
else:
|
|
8095
|
+
else:
|
|
8035
8096
|
try:
|
|
8036
8097
|
ip = socket.gethostbyname(input_str)
|
|
8037
8098
|
targets.add(ip)
|
|
8038
8099
|
except:
|
|
8039
|
-
print(f"Failed to resolve
|
|
8040
|
-
except Exception
|
|
8041
|
-
print(
|
|
8100
|
+
print(f"Failed to resolve: {input_str}")
|
|
8101
|
+
except Exception:
|
|
8102
|
+
print("Error processing input")
|
|
8042
8103
|
return list(targets)
|
|
8043
8104
|
|
|
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
8105
|
def udp_tcp_main098():
|
|
8053
8106
|
user_input = input("Enter IP/URL/CIDR or file path: ")
|
|
8054
8107
|
targets = get_targets_from_input(user_input)
|
|
@@ -8057,13 +8110,34 @@ def udp_tcp():
|
|
|
8057
8110
|
print("No valid targets found.")
|
|
8058
8111
|
return
|
|
8059
8112
|
|
|
8113
|
+
output_file = input("Enter output filename (e.g., results.txt): ").strip()
|
|
8114
|
+
if not output_file:
|
|
8115
|
+
output_file = "scan_results.txt"
|
|
8116
|
+
|
|
8117
|
+
if not output_file.endswith('.txt'):
|
|
8118
|
+
output_file += '.txt'
|
|
8119
|
+
|
|
8120
|
+
cwd = os.getcwd()
|
|
8121
|
+
filepath = os.path.join(cwd, output_file)
|
|
8122
|
+
|
|
8123
|
+
print(f"\nStarting scan of {len(targets)} target(s)...")
|
|
8124
|
+
print(f"Live results saving to: {filepath}")
|
|
8125
|
+
print("-" * 60)
|
|
8126
|
+
|
|
8127
|
+
stats = {'tcp': 0, 'udp': 0, 'total': 0}
|
|
8060
8128
|
start_time = time.time()
|
|
8061
|
-
|
|
8129
|
+
|
|
8130
|
+
all_results = batch_scan(targets, stats, filepath)
|
|
8131
|
+
|
|
8062
8132
|
elapsed = time.time() - start_time
|
|
8063
8133
|
|
|
8064
|
-
|
|
8065
|
-
print(f"
|
|
8066
|
-
print(f"
|
|
8134
|
+
print(f"\n" + "-" * 60)
|
|
8135
|
+
print(f"Scan completed in {elapsed:.2f} seconds")
|
|
8136
|
+
print(f"TCP: {stats['tcp']} | UDP: {stats['udp']} | Total: {stats['total']}")
|
|
8137
|
+
print(f"Results saved to: {filepath}")
|
|
8138
|
+
|
|
8139
|
+
if stats['total'] == 0:
|
|
8140
|
+
print("No open ports found.")
|
|
8067
8141
|
|
|
8068
8142
|
udp_tcp_main098()
|
|
8069
8143
|
|
|
@@ -16876,7 +16950,7 @@ def banner():
|
|
|
16876
16950
|
MAGENTA + "██╔═══╝ ██╔══██╗██║ ██║" + LIME + "user should understand that useage of this script may be" + ENDC,
|
|
16877
16951
|
MAGENTA + "██║ ██║ ██║╚██████╔╝" + LIME + "concidered an attack on a data network, and may violate terms" + ENDC,
|
|
16878
16952
|
MAGENTA + "╚═╝ ╚═╝ ╚═╝ ╚═════╝" + LIME + "of service, use on your own network or get permission first" + ENDC,
|
|
16879
|
-
PURPLE + "script_version@ 1.2.
|
|
16953
|
+
PURPLE + "script_version@ 1.2.3 ®" + ENDC,
|
|
16880
16954
|
ORANGE + "All rights reserved 2022-2025 ♛: ®" + ENDC,
|
|
16881
16955
|
MAGENTA + "In Collaboration whit Ayan Rajpoot ® " + ENDC,
|
|
16882
16956
|
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
|