CodeAlpha Cybersecurity Internship - Task 1
A comprehensive Python-based network packet sniffer that captures and analyzes network traffic in real-time
π― Educational β’ π Security Analysis β’ π Network Protocol Understanding
This tool helps understand network protocols, data flow, and packet structure for educational and security analysis purposes. Built as part of the CodeAlpha Cybersecurity Internship program, it provides comprehensive packet analysis capabilities with an intuitive interface.
|
|
Requirement | Version | Purpose |
---|---|---|
π Python | 3.6+ | Core runtime |
π¦ Scapy | Latest | Packet manipulation |
π Root Access | Required | Packet capture |
π Network Interface | Active | Traffic monitoring |
git clone https://github.com/musagithub1/CodeAlpha_NetworkSniffer.git
cd CodeAlpha_NetworkSniffer
# Using Makefile (recommended)
make install
# Or manually
pip install -r requirements.txt
# π Capture all packets
sudo python3 packet_sniffer.py
# π― Capture specific count
sudo python3 packet_sniffer.py -c 10
# π§ Apply traffic filter
sudo python3 packet_sniffer.py -f "tcp port 80"
# π HTTP traffic with file save
sudo python3 packet_sniffer.py -f "tcp port 80" --save
# βοΈ Specific interface with timeout
sudo python3 packet_sniffer.py -i eth0 --timeout 30
# π DNS queries monitoring
sudo python3 packet_sniffer.py -f "port 53"
# π― Target specific host
sudo python3 packet_sniffer.py -f "host google.com"
Command | Action | Description |
---|---|---|
make install |
π¦ | Install all dependencies |
make run |
Run with default settings | |
make run-count |
π’ | Run with packet limit |
make run-filter |
π§ | Run with HTTP filter |
make clean |
π§Ή | Clean temporary files |
Option | Description | Example Usage |
---|---|---|
-c, --count |
Number of packets to capture (0 = infinite) | -c 50 |
-f, --filter |
Berkeley Packet Filter (BPF) string | -f "tcp port 443" |
--save |
Save captured packets to JSON file | --save |
-i, --interface |
Specify network interface to monitor | -i eth0 |
--timeout |
Stop capture after specified seconds | --timeout 60 |
π Enhanced Network Packet Sniffer
π‘ CodeAlpha Cybersecurity Internship Project
==================================================
============================================================
Packet #1 - 2024-01-15 14:30:25
============================================================
π Ethernet Frame:
Source MAC: aa:bb:cc:dd:ee:ff
Destination MAC: 11:22:33:44:55:66
Type: 0x800
π IP Packet:
Source IP: 192.168.1.100
Destination IP: 8.8.8.8
Protocol: UDP
TTL: 64
Total Length: 76 bytes
π¦ UDP Datagram:
Source Port: 12345 (12345)
Dest Port: 53 (DNS)
Length: 56 bytes
DNS Query: Query for www.google.com
============================================================
CodeAlpha_NetworkSniffer/
βββ π packet_sniffer.py # Main application core
βββ π requirements.txt # Python dependencies
βββ βοΈ Makefile # Build automation
βββ π« .gitignore # Version control rules
βββ π README.md # Project documentation
βββ π captured_packets.json # Generated output (--save)
|
|
Principle | Description |
---|---|
π― Ethical Use Only | Tool designed for educational and authorized security testing |
π‘οΈ Privacy Respect | Only monitor networks you own or have explicit permission |
βοΈ Legal Compliance | Ensure adherence to local laws and regulations |
π€ Responsible Disclosure | Report discovered vulnerabilities through proper channels |
This project welcomes educational improvements and bug fixes
- π΄ Fork the repository
- π Create a feature branch
- β¨ Make your improvements
- π€ Submit a pull request
This project is developed for educational purposes as part of the CodeAlpha Cybersecurity Internship program.
Mussa Khan
CodeAlpha Cybersecurity Intern
Special Thanks To:
- π CodeAlpha - For the incredible internship opportunity
- π Scapy Developers - For the outstanding packet manipulation library
- π₯ Python Community - For comprehensive networking tools and support
This tool is intended exclusively for educational and authorized security testing purposes. Users assume full responsibility for ensuring compliance with applicable laws and obtaining proper authorization before monitoring any network traffic.
Built with β€οΈ for cybersecurity education