-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_port_scan.py
More file actions
78 lines (64 loc) · 2.43 KB
/
Copy pathdebug_port_scan.py
File metadata and controls
78 lines (64 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""
Debug script to test port scanning and see what data is being returned.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
from pgdn_scanner.scanners.port_scanner import PortScanner
import json
def debug_port_scan():
"""Debug port scan to see raw data."""
print("🔍 Debug Port Scan Test")
print("=" * 50)
# Create port scanner
config = {
'timeout': 10,
'max_threads': 4,
'nmap_timeout': 15
}
scanner = PortScanner(config)
# Test with a few ports
target = "sui-mainnet.interestlabs.io"
ports = [22, 80, 3306]
print(f"🎯 Target: {target}")
print(f"🔢 Ports: {ports}")
print()
# Run the scan
print("🚀 Running port scan...")
result = scanner.scan(target, ports=ports, nmap_args="-sV")
print("\n📊 Raw Port Scanner Result:")
print("=" * 50)
print(json.dumps(result, indent=2, default=str))
# Check if we have detailed results
if 'detailed_results' in result:
print(f"\n🔍 Found {len(result['detailed_results'])} detailed results")
for i, detail in enumerate(result['detailed_results']):
print(f"\n📋 Detailed Result {i+1}:")
print(f" Port: {detail.get('port')}")
print(f" Open: {detail.get('is_open')}")
print(f" State: {detail.get('port_state')}")
print(f" Service: {detail.get('service')}")
print(f" Version: {detail.get('version')}")
print(f" Banner: {detail.get('banner', 'None')[:100]}...")
print(f" SSL Info: {'Yes' if detail.get('ssl_info') else 'No'}")
print(f" Nmap Results: {'Yes' if detail.get('nmap_results') else 'No'}")
# Check banners
banners = result.get('banners', {})
if banners:
print(f"\n🏷️ Service Banners Found: {len(banners)}")
for port, banner in banners.items():
print(f" Port {port}: {banner[:100]}...")
else:
print("\n🏷️ No service banners found")
# Check TLS info
tls_info = result.get('tls', {})
if tls_info:
print(f"\n🔒 TLS Info Found: {len(tls_info)} ports")
for port, info in tls_info.items():
print(f" Port {port}: {info.get('protocol_version', 'Unknown')}")
else:
print("\n🔒 No TLS info found")
print("\n✅ Debug complete!")
if __name__ == "__main__":
debug_port_scan()