def pktH(pkt): if pkt.haslayer(Dot11ProbeReq): if len(pkt) > 0: testcase = pkt.addr2 + '---' + pkt.info if testcase not in clientprobes: # add this to the table and the database clientprobes.add(testcase) print "New Client Probe: " + pkt.addr2 + ' ' + pkt.info [clientmac, ssid] = testcase.split('---') counter = 1 if len(ssid) > 0: db.execute( "INSERT OR IGNORE INTO clientprobes(clientmac, ssid, location) VALUES(?,?,?)", (clientmac, ssid, location)) db.commit() print colours.greentxt( "\n---------------- Client Probes ----------------\n") for probe in clientprobes: [clientmac, ssid] = probe.split('---') if counter < 10: print colours.redtxt( str(counter)) + ' : ' + colours.bluetxt( clientmac) + ' --> ' + colours.yellowtxt(ssid) else: print colours.redtxt( str(counter)) + ' : ' + colours.bluetxt( clientmac) + ' --> ' + colours.yellowtxt(ssid) counter = counter + 1 print colours.greentxt( "\n-----------------------------------------------\n")
def pktH(pkt): if pkt.haslayer(Dot11ProbeReq): if len(pkt) > 0: testcase = pkt.addr2 + '---' + pkt.info if testcase not in clientprobes: # add this to the table and the database clientprobes.add(testcase) print "New Client Probe: " + pkt.addr2 + ' ' + pkt.info [clientmac, ssid] = testcase.split('---') counter = 1 if len(ssid) > 0: db.execute("INSERT OR IGNORE INTO clientprobes(clientmac, ssid, location) VALUES(?,?,?)", (clientmac, ssid, location)) db.commit() print colours.greentxt("\n---------------- Client Probes ----------------\n") for probe in clientprobes: [clientmac, ssid] = probe.split('---') if counter < 10 : print colours.redtxt(str(counter)) + ' : ' + colours.bluetxt(clientmac) + ' --> ' + colours.yellowtxt(ssid) else: print colours.redtxt(str(counter)) + ' : ' + colours.bluetxt(clientmac) + ' --> ' + colours.yellowtxt(ssid) counter = counter + 1 print colours.greentxt("\n-----------------------------------------------\n")
str(counter)) + ' : ' + colours.bluetxt( clientmac) + ' --> ' + colours.yellowtxt(ssid) else: print colours.redtxt( str(counter)) + ' : ' + colours.bluetxt( clientmac) + ' --> ' + colours.yellowtxt(ssid) counter = counter + 1 print colours.greentxt( "\n-----------------------------------------------\n") total = len(sys.argv) if total < 3: print banner() print "[!] Usage : ./wifichomp.py <interface> <count>" print "[?] Example : ./wifichomp.py mon0 10000\n" else: clientprobes = set() location = raw_input(colours.greentxt("Enter the location : ")) db = sqlite3.connect('client_probes.db') # creates set to keep track of duplicates print colours.bluetxt("Setting up DB structure") setupdb() loc = location.upper() print banner() print colours.yellowtxt("Starting Sniffing at the location : " + colours.redtxt(loc)) sniff(iface=sys.argv[1], count=sys.argv[2], prn=pktH) db.close()
print colours.greentxt("\n---------------- Client Probes ----------------\n") for probe in clientprobes: [clientmac, ssid] = probe.split('---') if counter < 10 : print colours.redtxt(str(counter)) + ' : ' + colours.bluetxt(clientmac) + ' --> ' + colours.yellowtxt(ssid) else: print colours.redtxt(str(counter)) + ' : ' + colours.bluetxt(clientmac) + ' --> ' + colours.yellowtxt(ssid) counter = counter + 1 print colours.greentxt("\n-----------------------------------------------\n") total = len(sys.argv) if total < 3: print banner() print "[!] Usage : ./wifichomp.py <interface> <count>" print "[?] Example : ./wifichomp.py mon0 10000\n" else: clientprobes = set() location = raw_input(colours.greentxt("Enter the location : ")) db = sqlite3.connect('client_probes.db') # creates set to keep track of duplicates print colours.bluetxt("Setting up DB structure") setupdb() loc = location.upper() print banner() print colours.yellowtxt("Starting Sniffing at the location : " + colours.redtxt(loc)) sniff(iface=sys.argv[1], count=sys.argv[2], prn = pktH) db.close()
#!/usr/bin/python # Testing colours file import colours print colours.redtxt("This is me printing in Red") print colours.greentxt("This is me printing in Green") for num in range(5): num = colours.bluetxt(str(num)) print "This is me printing %s inside the loop as a pre-coloured variable" %num print "This is me chaining the colours with nesting :" + colours.redtxt("This is a Red block with a " + colours.yellowtxt("Yellow ") + "block inside.")