I have found a simple code that sacn my environment
work good
but I want to set my own time it will start the scan
and also to now on which channels it is running\scanning
so it will run 5 full scan (all channels) , wait x min -- run scan again
what do I need to set in the sniif command?
work good
but I want to set my own time it will start the scan
and also to now on which channels it is running\scanning
so it will run 5 full scan (all channels) , wait x min -- run scan again
what do I need to set in the sniif command?
def handle_packet(pkt): if not pkt.haslayer(Dot11): return if pkt.type == 0 and (pkt.subtype == 4 or pkt.subtype == 0 or pkt.subtype == 2): #subtype used to be 8 (APs) but is now 4 (Probe Requests) #logging.debug('Probe Recorded with MAC ' + curmac) curmac = pkt.addr2 curmac = curmac.upper() #Assign variable to packet mac and make it uppercase SEEN_DEVICES.add(curmac) #Add to set of known devices (sets ignore duplicates so it is not a problem) for item in SEEN_DEVICES: TS = datetime.now().strftime("%d/%m/%Y %H:%M:%S:%f") if item in KNOWN_DEVICES: pass #item = d[item] #print(pkt.show()) if pkt.dBm_AntSignal > -50 : print (TS + ': ' + item + ' MAC TimeStamp : ' + str(pkt.mac_timestamp) + ' with SSID: {pkt.info}'.format(pkt=pkt) + ' subtype is : ' + str(pkt.subtype) + ' Signal : ' + str(pk$ #else: #print (TS + " " + item + ' with SSID: {pkt.info}'.format(pkt=pkt)) print('_________________') def main(): logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',filename='wifiscanner.log',level=logging.DEBUG) #setup logging to file logging.info('\n' + '\033[93m' + 'Wifi Scanner Initialized' + '\033[0m' + '\n') #announce that it has started to log file with yellow color print('\n' + '\033[93m' + 'Wifi Scanner Initialized' + '\033[0m' + '\n') #announce that it has started to command line with yellow color (/n is newline) import argparse parser = argparse.ArgumentParser() parser.add_argument('--interface', '-i', default='mon0', # Change mon0 to your monitor-mode enabled wifi interface help='monitor mode enabled interface') args = parser.parse_args() sniff(iface=args.interface, prn=handle_packet) #start sniffin running = 1 while 1: time.sleep(1) # Supposed to make an infinite loop, but for some reason it stops after a while