A minimal Python snippet for observing locally forwarded TCP traffic. Built for educational, debugging, and research scenarios in controlled environments only.
This is a snippet, not an application.
Note This project does not crawl, scan, deanonymize, or monitor remote systems. It only inspects traffic that you explicitly forward to your own local machine.
- Listens on a configurable local TCP port.
- Captures basic packet metadata.
- Records timestamps, source and destination IPs, and ports.
- Writes results to a CSV file for later inspection.
No payload inspection. No protocol decoding. Metadata only.
- Debugging local port-forward or proxy setups.
- Verifying that forwarded traffic actually reaches the expected endpoint.
- Studying TCP connection patterns in a safe lab setup.
- Teaching fundamentals of packet capture and network metadata.
- Lightweight validation of service behavior for blue-team exercises.
- Set the local port in the script:
LOCAL_PORT = 12345- Run the snippet:
python basic_example.py- Review the generated CSV file for timing and connection flow.
- Local traffic only.
- Requires traffic to be forwarded to the specified port.
- Not designed for high-volume capture.
- Not a monitoring or surveillance solution.
This project is provided for educational purposes only. Use it exclusively on systems, networks, and traffic you own or are explicitly authorized to inspect. The author assumes no responsibility for misuse.
MIT License. See the LICENSE file for details.
© Volkan Sah