packet sniffer in python

This commit is contained in:
Shreejan 2022-10-08 14:11:19 +05:30
parent 5d4309d62f
commit cc206b3124
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# PACKET SNIFFER
Hi all! This is a packet sniffer in python.
## Libraries
I have used ```scapy``` library
## Getting started
1. First of all -
```
pip install requirements.txt
```
2. Secondly -
```
python main.py
```
OR
```
sudo python3 main.py
```
That's all. This is how we can use the packet sniffer.

View File

@ -0,0 +1,20 @@
import scapy.all as scapy
from scapy.layers import http
def sniffing(interface):
scapy.sniff(iface=interface,
storage=False, prn=process_packet, filter='tcp')
def process_packet(packet):
if packet.haslayer(http.HTTPRequest):
print(packet[http.HTTPRequest].Host)
def main():
sniffing("Wi-Fi")
if __name__ == "__main__":
main()

View File

@ -0,0 +1 @@
scapy==2.4.5