Skip to content

Commit e0ff49e

Browse files
Revise README for advanced port scanner tool
Updated README to reflect new features and improvements for the advanced port scanner tool, including usage examples and project structure.
1 parent 5eb21be commit e0ff49e

File tree

1 file changed

+233
-2
lines changed

1 file changed

+233
-2
lines changed

README.md

Lines changed: 233 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,233 @@
1-
# basic-port-scanner
2-
A simple Python port scanner for basic network reconnaissance.
1+
# 🔎 Advanced Port Scanner (Python)
2+
3+
A fast, multi-threaded **TCP port scanning tool** built for reconnaissance, network enumeration, and OSCP-style labs.
4+
This scanner supports **custom port ranges**, **banner grabbing**, **randomized scan order (IDS evasion)**, and **JSON/TXT reporting**.
5+
6+
This version replaces the simplistic beginner script with a **professional-grade scanning utility** suitable for security portfolios and real-world assessments.
7+
8+
---
9+
10+
<p align="center">
11+
<img src="assets/Port Scanner.png" width="600">
12+
</p>
13+
<br>
14+
<p align="center">
15+
<img src="https://img.shields.io/badge/status-active-brightgreen">
16+
<img src="https://img.shields.io/badge/language-python-blue">
17+
<img src="https://img.shields.io/badge/type-offensive%20security-red">
18+
<img src="https://img.shields.io/badge/license-MIT-yellow">
19+
</p>
20+
21+
# 📂 Project Structure
22+
23+
```
24+
basic-port-scanner/
25+
│── src/
26+
│ └── port_scanner.py
27+
│── reports/
28+
│ └── .gitkeep
29+
│── wordlists/
30+
│ └── .gitkeep
31+
│── README.md
32+
│── LICENSE
33+
```
34+
35+
---
36+
37+
# 🚀 Features
38+
39+
### ✔ Multi-threaded TCP Connect Scanning
40+
41+
Uses **100 concurrent threads** to accelerate scanning, handling large port ranges efficiently.
42+
43+
### ✔ Customizable Port Inputs
44+
45+
Supports:
46+
47+
```
48+
-p 1-1024 # range
49+
-p 80,443,3306 # comma-separated
50+
-p 22 # single port
51+
```
52+
53+
### ✔ Banner Grabbing
54+
55+
Identifies running services by capturing application banners:
56+
57+
```
58+
SSH-2.0-OpenSSH_8.2
59+
Apache/2.4.54
60+
MySQL Protocol 10
61+
```
62+
63+
### ✔ Randomized Port Order (Basic IDS Evasion)
64+
65+
Ports are shuffled before scanning to avoid linear port sweep signatures.
66+
67+
### ✔ JSON & TXT Reporting
68+
69+
Reports stored under `/reports/`:
70+
71+
* JSON structured report
72+
* TXT list of open ports
73+
74+
### ✔ Graceful Error Handling
75+
76+
Handles:
77+
78+
* Host resolution errors
79+
* Network timeouts
80+
* Connection failures
81+
* Interrupted scans
82+
83+
---
84+
85+
# 🧪 Usage
86+
87+
### **Scan common port range (1–1024)**
88+
89+
```bash
90+
python3 src/port_scanner.py 192.168.1.10 -p 1-1024
91+
```
92+
93+
### **Scan a custom set of ports**
94+
95+
```bash
96+
python3 src/port_scanner.py scanme.nmap.org -p 80,443,22,3306
97+
```
98+
99+
### **Scan a single port**
100+
101+
```bash
102+
python3 src/port_scanner.py example.com -p 443
103+
```
104+
105+
### Example Output
106+
107+
```
108+
========== Port Scan Started ==========
109+
Target: 192.168.1.10
110+
Ports: 1-1024
111+
Threads: 100
112+
----------------------------------------
113+
114+
[OPEN] 22/tcp → SSH-2.0-OpenSSH_8.2
115+
[OPEN] 80/tcp
116+
117+
========== Scan Complete ==========
118+
Open Ports Found: 2
119+
Scan Duration: 3.24 seconds
120+
====================================
121+
```
122+
123+
---
124+
125+
# 📄 Generated Reports
126+
127+
Inside `/reports/`:
128+
129+
```
130+
portscan-20251114-160420.json
131+
portscan-20251114-160420.txt
132+
```
133+
134+
### JSON Example
135+
136+
```json
137+
{
138+
"target": "192.168.1.10",
139+
"open_ports": [
140+
{"port": 22, "banner": "SSH-2.0-OpenSSH_8.2"},
141+
{"port": 80, "banner": null}
142+
],
143+
"scan_duration": 3.24
144+
}
145+
```
146+
147+
---
148+
149+
# 🛠 How It Works (Internals)
150+
151+
### 1. Host Resolution
152+
153+
Resolves domain → IPv4:
154+
155+
```
156+
socket.gethostbyname(target)
157+
```
158+
159+
### 2. Multi-threaded Connect Scan
160+
161+
Each worker pulls a port from a queue and attempts:
162+
163+
```
164+
s.connect_ex((ip, port))
165+
```
166+
167+
If result == 0 → port open.
168+
169+
### 3. Banner Grabbing
170+
171+
If port is open, tool attempts:
172+
173+
```
174+
s.recv(1024)
175+
```
176+
177+
to capture service fingerprints.
178+
179+
### 4. Randomized Port Order
180+
181+
Shuffles ports for basic stealth against sequential-scan detection.
182+
183+
### 5. Reporting
184+
185+
Results compiled into:
186+
187+
* TXT output
188+
* JSON structured file
189+
190+
---
191+
192+
# 📈 Performance
193+
194+
Testing on local VM:
195+
196+
| Ports Scanned | Threads | Duration |
197+
| ------------- | ------- | -------- |
198+
| 1–1024 | 100 | ~3s |
199+
| 1–65535 | 300 | ~40–60s |
200+
201+
(Depends heavily on latency and host responsiveness.)
202+
203+
---
204+
205+
# 📌 Future Enhancements
206+
207+
* Asyncio-based ultra-fast scanning
208+
* SYN-scan mode (requires raw sockets)
209+
* UDP scanning mode
210+
* OS fingerprinting (TTL analysis)
211+
* NSE-style script hooks
212+
* Banner signature matching
213+
214+
---
215+
216+
# 🧑‍⚖️ Ethical Disclaimer
217+
218+
This tool is intended **ONLY** for:
219+
220+
* Authorized penetration testing
221+
* Lab environments
222+
* Educational use
223+
224+
Scanning systems you do not own or have permission to test is **illegal and unethical**.
225+
226+
---
227+
228+
# 👨‍💻 Author
229+
230+
**Vignesh Mani**
231+
Offensive Security Researcher
232+
GitHub: [https://github.com/vigneshoffsec](https://github.com/vigneshoffsec)
233+
LinkedIn: [https://linkedin.com/in/vignesh-m17](https://linkedin.com/in/vignesh-m17)

0 commit comments

Comments
 (0)