Skip to content

Python firewall script that captures network traffic and writes logs to a file. It uses Scapy for packet sniffing and allows you to define simple filtering rules.

Notifications You must be signed in to change notification settings

John031265/PythonNetworkLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

PythonNetworkLogger

Python firewall script that captures network traffic and writes logs to a file. It uses Scapy for packet sniffing and allows you to define simple filtering rules.

Software/OS Requirements: Ubuntu 24.04 Scapy - pip install scapy

How It Works Packet Capture: Uses scapy.sniff() to capture packets in real time. Filtering Rules: Blocks packets from certain IPs or ports. Logging: Writes timestamped logs to network_traffic.log with action (ALLOWED or BLOCKED).

Logger.py is a basic type of firewall logger — it monitors and logs but does not actively drop packets at the OS level. If you want actual packet blocking, you’d need to integrate with iptables (Linux) or netsh (Windows).

Test setup Requirements: A VM with Ubuntu 24.04 and 2 network interfaces. The first interface connected to the local area network and the second to the intrenet/downstream/upstream. The Network Logger will log all traffic between these two segments.

About

Python firewall script that captures network traffic and writes logs to a file. It uses Scapy for packet sniffing and allows you to define simple filtering rules.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages