Professional Documents
Culture Documents
def logging(log):
with open("/var/log/pidens.log", "a") as f:
f.write(str(log)+"\n")
f.flush()
f.close()
def sniff_channel_hop(iface):
for i in range(1, 14):
os.system("iwconfig " + iface + " channel " + str(i))
sniff(iface=iface, count=15, prn=air_scan)
def air_scan(pkt):
"""
Scan all network with channel hopping
Collected all ssid and mac address information
:param pkt: result of sniff function
"""
if pkt.haslayer(Dot11Beacon):
ssid, bssid = pkt.info, pkt.addr2 hacer print de pkt.info, addr2 y
capability = pkt.sprintf("{Dot11Beacon:%Dot11Beacon.cap%}\
capability
{Dot11ProbeResp:%Dot11ProbeResp.cap%}")
enc = "Y"
if "privacy" not in capability:
enc = 'N'
info = "{}=*={}".format(enc, ssid)
if info not in info_list and info_list_2:
info_list.append(info)
info_list_2.append(info)
else:
info = "{}=*={}".format(enc, ssid)
if info not in info_list_2:
info_list_2.append(info)
if __name__ == '__main__':
https://es.stackoverflow.com/questions/32165/
iface = args.interface
qu%C3%A9-es-if-name-main
mode = "Monitor"
os.system("reset")
now = time.strftime("%c")
print banner
print "Information about test:"
print "---------"*7
print "[*]",now
print """[*] Analysis unencrypted network number and makes control \n---
between unencrypted and encrypted wireless networks"""
print "---------"*7
while True:
time.sleep(15)
pineapple = 0
info_list = []
info_list_2= []
sniff_channel_hop(iface)
p = pidens(info_list_2, pineapple)
opn = "[*] Total unecrypted networks: " + str(len(info_list))
opn = colored(opn, 'green', attrs=['reverse', 'blink'])
opn += colored("--THREAT !!!", 'red', attrs=['reverse', 'blink'])
if len(info_list) >=10:
print opn
print "-----------"*5
if p >= 2:
attrs=['reverse', 'blink'])
'blink'])
log = "[*]", time.strftime("%c"), " More than defined threshold SSID info"
logging(log)
print "-------------"*5