diff --git a/.travis.yml b/.travis.yml index 2bf1217..e6f93b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,10 @@ language: python sudo: required +dist: xenial python: - "2.7" install: - - sudo ./setup -script: nosetests -vv --nocapture + - pip install -r pip_dependencies + - sudo pip install -r pip_dependencies + - sudo -H ./setup +script: sudo nosetests -vv --nocapture diff --git a/core.py b/core.py index b2e65a8..e370a64 100644 --- a/core.py +++ b/core.py @@ -17,7 +17,7 @@ from pythonwifi.iwlibs import Wireless from capabilities import * from scapy.all import * -import network +from network import * sys.path.append("capabilities") class PinaColada(object): @@ -99,8 +99,10 @@ def beacon(self, pkt): print "AP MAC: %s with SSID: %s " % (pkt.addr2, pkt.info) def get_wifis(self): - print GOOD + "Sniffing for Wifi Beacons, output for newly disovered ones are below. Hit Ctrl-C when done." - sniff(iface=self.default_iface, prn=self.beacon) + print GOOD + "Sniffing for Wifi Beacons" + for network in wifi_scan(): + print network + def get_capabilities(self, category=None): caps = [] diff --git a/network.py b/network.py index 83a35ad..5f3a4cd 100644 --- a/network.py +++ b/network.py @@ -5,6 +5,27 @@ import datetime +#Scan all networks in wifi range and return an array of all of them. +def wifi_scan(): + proc = subprocess.Popen(["iwlist wlan0 scan | grep ESSID | sort | uniq | awk -F \"\\\"\" \'{print $2}\'"], stdout=subprocess.PIPE, shell=True) + networks = proc.stdout.read()[:-1].split('\n') + networks2 = [] + for item in networks: + valid = False + for char in item: + if char != '\\' and char != '0' and char != 'x': + valid = True + else: + if valid == True: + valid = True + else: + valid = False + if item == "" or valid == False: + networks2.append("Hidden Network") + else: + networks2.append(item) + return networks2 + #All other computers should be in an array of type computer, having (so far) an ip and a MAC address. class Computer(object): def __init__(self, ip, mac): diff --git a/pip_dependencies b/pip_dependencies new file mode 100644 index 0000000..2e5b8e6 --- /dev/null +++ b/pip_dependencies @@ -0,0 +1,11 @@ +flask +netifaces +colorama +scapy +netaddr +pexpect +wifi +python-wifi +psycopg2 +pycrypto +nose diff --git a/setup b/setup index 187a570..1d7bbe1 100755 --- a/setup +++ b/setup @@ -12,15 +12,8 @@ cd python-netfilterqueue python setup.py install cd .. apt install -y python-nmap -apt-get install -y python-pip pip install --upgrade pip -pip install netifaces -pip install scapy -pip install netaddr -pip install pexpect -pip install colorama -pip install wifi -pip install psycopg2 +apt-get install -y python-tk python setup_postgres.py wget https://pypi.python.org/packages/bc/ab/c49f97516f78c2b0cacb4f45873abc4ca9872942a9c4c19ded8052c8edda/python-wifi-0.6.1.tar.bz2 tar -xvf python-wifi-0.6.1.tar.bz2 diff --git a/tests.py b/tests.py index d923497..92d89ec 100644 --- a/tests.py +++ b/tests.py @@ -1,2 +1,11 @@ +import os +import pexpect +from colorama import * +import re + +prompt = Fore.BLUE + ">> " + Fore.RESET + def base_test(): - pass + cli = pexpect.spawn("sudo python cli.py") + cli.expect(re.escape(prompt)) +