A modular Python-based network diagnostics, monitoring, and analysis toolkit designed to demonstrate networking, systems programming, cybersecurity fundamentals, data persistence, concurrency, and software engineering principles.
This project started as a simple collection of networking scripts and evolved into a lightweight network observability platform capable of collecting, storing, analyzing, and visualizing network data.
git clone https://github.com/shahbajsingh/network-surfacing.git
cd network-surfacingpython3 -m venv venv
source venv/bin/activatepython -m venv venv
venv\Scripts\activatepip install -r requirements.txtor install the package directly:
pip install -e .The toolkit can be installed as a system command.
After running:
pip install -e .you can execute commands directly using:
netsurfinstead of:
python main.pynetsurf --helpExpected output:
Usage: netsurf [OPTIONS] COMMAND [ARGS]...
Commands:
ping
dns
scan
discover
http
api
ssl
banner
capture
pcap
log
compare
graph
graph-ports
report
Perform a ping:
netsurf ping google.comDNS lookup:
netsurf dns google.comPort scan:
netsurf scan scanme.nmap.orgAnalyze a website:
netsurf http https://google.comInspect an API:
netsurf api https://api.github.comGenerate a latency graph:
netsurf graph google.comGenerate a port history graph:
netsurf graph-ports scanme.nmap.orgGenerate an HTML report:
netsurf reportThis project uses a Python entry point defined in:
pyproject.toml
Example:
[project]
name = "network-surfacing"
version = "1.0.0"
[project.scripts]
netsurf = "cli.commands:app"This creates the executable command:
netsurfwhich launches the Typer CLI application.
Collect data:
netsurf ping google.com
netsurf dns google.com
netsurf scan scanme.nmap.org
netsurf http https://google.com
netsurf api https://api.github.com
netsurf ssl google.comGenerate visualizations:
netsurf graph google.com
netsurf graph-ports scanme.nmap.orgGenerate reports:
netsurf reportInspect logs:
tail -f data/logs/toolkit.logInspect database:
sqlite3 data/toolkit.dbMeasure host reachability and collect latency metrics.
netsurf ping google.comCapabilities:
- ICMP reachability testing
- Historical latency tracking
- Performance trend analysis
- Automatic logging
- Error tracking
Retrieve common DNS record types.
netsurf dns google.comSupported Records:
- A
- AAAA
- MX
- TXT
- NS
Capabilities:
- DNS enumeration
- DNS response timing
- Historical DNS query metrics
- Error tracking
Perform concurrent TCP port scanning.
netsurf scan scanme.nmap.orgCapabilities:
- Multi-threaded scanning
- Common service detection
- Historical port tracking
- Open/closed port monitoring
- Scan persistence
Common Ports:
| Port | Service |
|---|---|
| 21 | FTP |
| 22 | SSH |
| 25 | SMTP |
| 53 | DNS |
| 80 | HTTP |
| 110 | POP3 |
| 143 | IMAP |
| 443 | HTTPS |
| 3306 | MySQL |
| 5432 | PostgreSQL |
Perform subnet sweeps and discover active hosts.
netsurf discover 192.168.1.0/24Capabilities:
- CIDR expansion
- Host discovery
- Concurrent execution
- Active host reporting
- Historical scan storage
Analyze website responses and performance.
netsurf http https://google.comCollected Information:
- HTTP Status Code
- Response Time
- Content Type
- Server Header
- Historical Latency Metrics
Inspect REST APIs.
netsurf api https://api.github.comCollected Information:
- Status Code
- Response Headers
- Content Length
- JSON Structure
- Response Timing
Inspect remote TLS certificates.
netsurf ssl google.comCollected Information:
- Certificate Expiration
- Certificate Issuer
- TLS Connectivity
- SSL Timing Metrics
Retrieve service banners from listening services.
netsurf banner scanme.nmap.org 22Common Targets:
- SSH
- SMTP
- FTP
- Telnet
- Custom TCP Services
Capture live network traffic and save PCAP files.
Requires administrative privileges.
sudo netsurf capture 30Example:
sudo netsurf capture 60Output:
data/pcaps/capture_60.pcap
Capabilities:
- Live packet capture
- PCAP generation
- Traffic collection for analysis
Analyze previously captured PCAP files.
netsurf pcap data/pcaps/capture_60.pcapCapabilities:
- Packet counting
- Top talker identification
- Protocol analysis
- Traffic statistics
Analyze server log files.
netsurf log access.logCapabilities:
- Top IP identification
- Endpoint analysis
- Request frequency analysis
Supported Formats:
- Apache Access Logs
- Nginx Access Logs
- Similar structured logs
All scan results are stored in SQLite.
Database:
data/toolkit.db
Tracked Information:
- Scan Results
- Latency Measurements
- Open Port History
- Errors
- Discovery Results
Generate latency graphs from historical measurements.
netsurf graph google.comOutput:
data/reports/google.com_latency.png
Displays:
- Historical latency measurements
- Performance trends over time
Generate graphs of observed open ports.
netsurf graph-ports scanme.nmap.orgOutput:
data/reports/scanme.nmap.org_ports.png
Displays:
- Port frequency
- Service availability trends
Generate HTML reports.
netsurf reportOutput:
data/reports/dashboard.html
Contains:
- Recent scans
- Error summaries
- Historical metrics
- Generated visualizations
All modules write to a centralized log file.
Location:
data/logs/toolkit.log
View logs:
tail -f data/logs/toolkit.logLogged Events:
- Scan execution
- DNS lookups
- SSL checks
- HTTP requests
- Errors
- Performance metrics
Errors are automatically stored in the database.
Examples:
- DNS failures
- Connection failures
- Timeouts
- SSL issues
- Invalid hosts
Example failure:
netsurf dns any-fake-domain-1234.comCompare historical scan results.
netsurf compare scanme.nmap.orgDisplays:
- Newly opened ports
- Newly closed ports
- Service changes
Open SQLite database:
sqlite3 data/toolkit.dbList tables:
.tablesExpected Tables:
scans
errors
latency_measurements
port_history
View recent scans:
SELECT *
FROM scans
ORDER BY timestamp DESC
LIMIT 20;View errors:
SELECT *
FROM errors;View latency history:
SELECT *
FROM latency_measurements;network-surfacing/
│
├── analyzers/
│ ├── api_analyzer.py
│ ├── http_analyzer.py
│ ├── log_parser.py
│ └── pcap_analyzer.py
│
├── cli/
│ └── commands.py
│
├── database/
│ ├── db.py
│ ├── models.py
│ └── schema.py
│
├── reports/
│ ├── compare.py
│ ├── graphs.py
│ ├── html_report.py
│ └── network_graph.py
│
├── scanners/
│ ├── banner_grabber.py
│ ├── dns_lookup.py
│ ├── network_discovery.py
│ ├── packet_capture.py
│ ├── ping.py
│ ├── port_scanner.py
│ └── ssl_checker.py
│
├── utils/
│ ├── formatting.py
│ ├── logger.py
│ ├── networking.py
│ └── validators.py
│
├── data/
│ ├── logs/
│ ├── pcaps/
│ └── reports/
│
├── main.py
├── requirements.txt
└── README.md
- Python
- SQLite
- Typer
- Rich
- Requests
- dnspython
- Scapy
- Matplotlib
- NetworkX
- ThreadPoolExecutor
- Socket Programming
- TLS/SSL
- REST APIs
Populate historical data:
netsurf ping google.com
netsurf ping google.com
netsurf dns google.com
netsurf scan scanme.nmap.org
netsurf http https://google.com
netsurf api https://api.github.com
netsurf ssl google.com
netsurf banner scanme.nmap.org 22
netsurf graph google.com
netsurf reportReview outputs:
data/logs/toolkit.log
data/toolkit.db
data/reports/google.com_latency.png
data/reports/dashboard.html