Skip to content

#5#7

Open
Tejassveer08 wants to merge 5 commits intousarfoss:mainfrom
Tejassveer08:main
Open

#5#7
Tejassveer08 wants to merge 5 commits intousarfoss:mainfrom
Tejassveer08:main

Conversation

@Tejassveer08
Copy link

@Tejassveer08 Tejassveer08 commented Oct 15, 2025

Fixes #5
This PR ports and introduces multithreaded scanning functionality for Python 3.8 in branch feature/python3.8.

Changes:

  • Added src/single/scanner.py: single-threaded scanner (py3 reference and fallback).
  • Added src/multi/scanner_thread.py: thread-worker utilities with ThreadPoolExecutor.
  • Added src/mainScanner.py: user-facing multithreaded port scan CLI supporting port ranges, concurrency and timeouts.
  • Added src/ipscanner/ipscanner.py and init.py: utilities for expanding CIDR ranges and multithreaded host probing.

Why:

  • Multithreading accelerates port scanning and host discovery for large ranges or many ports.
  • The code uses Python 3.8 constructs (concurrent.futures ThreadPoolExecutor).
  • Uses TCP-probe approach for host liveness to avoid raw socket / privileged ICMP dependencies.

Notes:

  • Behavior mirrors the python2 master implementation (multithreading present there).
  • The multithreading design favors ThreadPoolExecutor for simplicity, portability and maintainability in Python 3.
  • Logging, argument validation and additional features can be added in subsequent PRs.

How to test:

  1. Checkout this branch and run:
    python3 src/mainScanner.py 127.0.0.1 --ports 22,80,443 --workers 50
  2. Or test IP scanning:
    python3 -c "from src.ipscanner.ipscanner import expand_cidr, scan_hosts_parallel; print(scan_hosts_parallel(expand_cidr('192.168.1.0/30'), max_workers=50))"

Please review coding style and propose any improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Multithreading feature in python3 for corresponding python2 files

1 participant