-
Notifications
You must be signed in to change notification settings - Fork 13
/
piuser.py
93 lines (83 loc) · 3.66 KB
/
piuser.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# coding=utf-8
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
from termcolor import colored
#import argparse
import time
import netifaces
import commands
import os
#parser = argparse.ArgumentParser()
#parser.add_argument('-c', '--corp', help="(Company name)", type=str)
#args = parser.parse_args()
banner = """
__________________________________
| PiUser -*- [-] [口] [×] |
|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄  ̄ |
| Analyze user behavior against fake access points |
| |
| ______ ______ ______ |
| | WiFi | | Threat | | Analysis | |
|  ̄ ̄ ̄ ̄ ̄ ̄  ̄ ̄ ̄ ̄ ̄ ̄  ̄ ̄ ̄ ̄ ̄ ̄ |
|_______________________________ __|
-------------------------------------------------------------------
"""
def Sniff_Probe(pkt):
if pkt.haslayer(Dot11ProbeReq):
ssid = pkt.info
mac = pkt.addr2
info = mac+"*-*"+ssid
#print info
if info not in probereq_list:
probereq_list.append(info)
def sniff_channel_hop(iface):
for i in range(1, 14):
os.system("iwconfig " + iface + " channel " + str(i))
sniff(iface=iface, count=60, prn=Sniff_Probe)
def PiUser(probereq_list):
blackssids = open("blacklist.txt","r").readlines()
blackssids = [black[:-1].lower() for black in blackssids]
for black in blackssids:
for probe in probereq_list:
ssid = probe.split("*-*")[1]
mac = probe.split("*-*")[0]
if black in ssid.lower():
mal_probe.append(probe)
"""
def CompanySSIDAnalysis(company_ssids, probereq_list):
for black in company_ssids:
for probe in probereq_list:
ssid = probe.split("*-*")[1]
mac = probe.split("*-*")[0]
if black in ssid.lower():
mal_probe.append(probe)
"""
if __name__ == "__main__":
probereq_list = []
mal_probe = []
ifaces = netifaces.interfaces()
#company_ssids = args.corp
#print company_ssids
print "[*] Available interfaces: ", ifaces
interface = raw_input("[*] Please select the wireless interface you wish to use: ")
print "-----------------------------------------------------\n"
if interface in ifaces:
iface_mode = commands.getoutput("iwconfig " + interface + "| awk '/Frequency:/ {print $4}'")
if "Monitor" in iface_mode:
os.system("reset")
print banner
print u"\u001b[43;1m P \u001b[41;1m R \u001b[42;1m O \u001b[43;1m B \u001b[45;1m E \u001b[46;1m R \u001b[41;1m E \u001b[45;1m G \u001b[0m______\n"
sniff_channel_hop(interface)
PiUser(probereq_list)
if len(mal_probe) != 0:
print "[*] Analyzed ", len(probereq_list), "Probe Request(s)"
print "[*] Found ", len(mal_probe), "critical probe request!!!"
print "[*] Critical Probe Requests:"
for i in mal_probe:
print " [-] MAC: ", i.split("*-*")[0], " Critical SSID: ", i.split("*-*")[1]
if len(mal_probe) >=3: #Treshold
print "[*] Critical enviromental !!!"
else:
print "[*] Analyzed ", len(probereq_list), "Probe Request(s)"
print "[*] Not found critical SSID(s) :)"