scan time
workers
tests
coverage
What started as a simple Python exercise — "can I scan ports concurrently?" — grew into a multi-threaded network security scanner with service fingerprinting, vulnerability detection, CVE intelligence from NVD, geolocation via IPinfo.io, and structured JSON reporting. Each version was a deliberate learning step, not just feature addition.
The goal was never to replace Nmap. It was to understand what Nmap actually does under the hood — TCP handshakes, banner grabbing, service identification, timeout handling — by building the equivalent from scratch in Python.
# Core concept: banner grab on open ports
import socket
def probe_port(host, port, timeout=1.0):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(timeout)
if s.connect_ex((host, port)) == 0:
try:
s.send(b'HEAD / HTTP/1.0\r\n\r\n')
return s.recv(1024).decode(errors='ignore')
except:
return "open"
return None
concurrent.futures.ThreadPoolExecutor with up to 500 workers, turning a 90-second scan into under 10 seconds for 1,000 ports.from concurrent.futures import ThreadPoolExecutor, as_completed
def scan(host, ports, workers=200):
results = {}
with ThreadPoolExecutor(max_workers=workers) as executor:
futures = {executor.submit(probe_port, host, p): p for p in ports}
for future in as_completed(futures):
port = futures[future]
result = future.result()
if result:
results[port] = result
return results
PortScanner— concurrent scanning, timeout managementVulnerabilityDetector— severity-rated rule matchingCVEProvider— NVD API v2.0 with 7-day TTL cacheGeolocationLookup— IPinfo.io integrationReportGenerator— structured JSON output
The major upgrade: real-time CVE lookups from the NVD API, so detected services are cross-referenced against known vulnerability data.
(45s → 8s)
(80MB → 45MB)
(15% → 5%)
hit rate
- NVD API v2.0 integration with CVSS scoring (LOW / MEDIUM / HIGH / CRITICAL)
- 7-day TTL cache for CVE data — avoids repeated API calls for the same services
- CWE IDs, affected products, and reference links included in JSON reports
- Real-time
tqdmprogress bars with live port count - Multi-level logging: DEBUG / INFO / WARNING / ERROR via Python's logging module
git clone https://github.com/karim871/cybersecurity-audit-tool.git cd cybersecurity-audit-tool python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt # Basic scan (always test on localhost first) python src/main.py 127.0.0.1 -p 1-1000 # Fast scan with 500 workers + verbose output python src/main.py 127.0.0.1 -p 1-1000 -w 500 -v # Full scan with CVE intelligence + JSON report python src/main.py 127.0.0.1 -p 1-65535 --enable-cve -o reports/scan.json # Common vulnerable services audit python src/main.py 127.0.0.1 -p 21,22,23,25,445,3389 -v