forked from sogeti-esec-lab/HomePlugPWN
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdiscovery.py
More file actions
37 lines (31 loc) · 1.21 KB
/
discovery.py
File metadata and controls
37 lines (31 loc) · 1.21 KB
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
33
34
35
36
37
#!/usr/bin/env python3
import sys
import binascii
import threading
from layerscapy.HomePlugAV import *
from optparse import OptionParser
"""
Copyright (C) Device Discovery tool by FlUxIuS (Sebastien Dudek)
"""
dictio = {}
def appendindic(pkt):
macad = pkt.src
if macad not in dictio.keys() and macad != "00:00:00:00:00:00":
dictio[macad] = None
print ("\t Found Station: %s" % macad)
def listen():
sniff(prn=appendindic, lfilter=lambda pkt:pkt.haslayer(HomePlugAV), timeout=5)
if __name__ == "__main__":
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-i", "--iface", dest="iface", default="eth0",
help="select an interface to Enable sniff mode and sniff indicates packets", metavar="INTERFACE")
parser.add_option("-s", "--source", dest="sourcemac", default="00:c4:ff:ee:00:00",
help="source MAC address to use", metavar="SOURCEMAC")
(options, args) = parser.parse_args()
tlisten = threading.Thread(None, listen, None)
print ("[+] Listening for confirmations...")
tlisten.start()
print ("[+] Sending Get Device Type Requests")
pkt = Ether(src=options.sourcemac)/HomePlugAV()
sendp(pkt, iface=options.iface)