From 9584e3f802551b5cf399e23aa31652d59e5271d6 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Mon, 21 Nov 2016 19:41:42 -0500 Subject: [PATCH 01/21] Fixed setup for ubuntu --- setup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup b/setup index 187a570..f6dc3e7 100755 --- a/setup +++ b/setup @@ -20,7 +20,8 @@ pip install netaddr pip install pexpect pip install colorama pip install wifi -pip install psycopg2 +apt-get install -y python-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 From 2838aa79ff7a38ff0c81feb87ded016e069beaea Mon Sep 17 00:00:00 2001 From: George Hughey Date: Mon, 21 Nov 2016 19:52:04 -0500 Subject: [PATCH 02/21] Travis setup script --- setup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup b/setup index f6dc3e7..2faf280 100755 --- a/setup +++ b/setup @@ -2,6 +2,7 @@ apt-get update apt-get install -y git-core apt-get install -y postgresql apt-get install -y python-dev +apt-get install -y python-flask sudo service postgresql start su -c "psql -c \"create user aces with password 'aces';\"" postgres su -c "createdb network" postgres @@ -14,12 +15,12 @@ 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 +apt-get install -y python-netifaces +apt-get install -y python-colorama apt-get install -y python-psycopg2 apt-get install -y python-tk python setup_postgres.py From ee0417dedd47bf336f90b5aa3a8711af584c7a77 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Mon, 21 Nov 2016 20:02:05 -0500 Subject: [PATCH 03/21] Travis tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2bf1217..a23ef1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,5 @@ sudo: required python: - "2.7" install: - - sudo ./setup + - sudo -H ./setup script: nosetests -vv --nocapture From f860734ea0b65be0af588f6d7e8fbe2ebadeb841 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 20:04:26 -0500 Subject: [PATCH 04/21] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a23ef1d..b814405 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python sudo: required +dist: xenial python: - "2.7" install: From 1ca7d62fd6df58456951f708947135f107efecb1 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 20:08:30 -0500 Subject: [PATCH 05/21] Update setup --- setup | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup b/setup index 2faf280..c421c7e 100755 --- a/setup +++ b/setup @@ -20,7 +20,9 @@ pip install netaddr pip install pexpect pip install wifi apt-get install -y python-netifaces -apt-get install -y python-colorama +pip install colorama +pip install flask +pip install netifaces apt-get install -y python-psycopg2 apt-get install -y python-tk python setup_postgres.py From 1e43ea2f8fccc40b14bea61bfca4721f72eff1b3 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 20:18:56 -0500 Subject: [PATCH 06/21] Update setup --- setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup b/setup index c421c7e..2944db0 100755 --- a/setup +++ b/setup @@ -1,8 +1,11 @@ apt-get update +apt-get install -y python-flask +apt-get install -y python-pip +pip install flask +pip install netifaces apt-get install -y git-core apt-get install -y postgresql apt-get install -y python-dev -apt-get install -y python-flask sudo service postgresql start su -c "psql -c \"create user aces with password 'aces';\"" postgres su -c "createdb network" postgres @@ -13,7 +16,6 @@ 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 scapy pip install netaddr @@ -21,8 +23,6 @@ pip install pexpect pip install wifi apt-get install -y python-netifaces pip install colorama -pip install flask -pip install netifaces apt-get install -y python-psycopg2 apt-get install -y python-tk python setup_postgres.py From 1ad219fed4be9a37c9d774d0964abb55fe51c138 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 20:26:34 -0500 Subject: [PATCH 07/21] Update setup --- setup | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup b/setup index 2944db0..b9880f7 100755 --- a/setup +++ b/setup @@ -1,8 +1,6 @@ apt-get update apt-get install -y python-flask apt-get install -y python-pip -pip install flask -pip install netifaces apt-get install -y git-core apt-get install -y postgresql apt-get install -y python-dev From d0edc60e9279f6c47e9b3f72e526d49a8650c41c Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 01:29:02 +0000 Subject: [PATCH 08/21] Added pip script --- pip_dependencies | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pip_dependencies diff --git a/pip_dependencies b/pip_dependencies new file mode 100644 index 0000000..e132fca --- /dev/null +++ b/pip_dependencies @@ -0,0 +1,3 @@ +flask +netifaces +colorama From 1a6ab1b86765689b5b3b7affda8e3029873870ac Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 20:34:01 -0500 Subject: [PATCH 09/21] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b814405..5b0b985 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,6 @@ dist: xenial python: - "2.7" install: + - pip install -r pip_dependencies - sudo -H ./setup script: nosetests -vv --nocapture From 83a2e551bb99d2de98c1289d5187caefc2444503 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 01:38:38 +0000 Subject: [PATCH 10/21] More dependencies for pip --- pip_dependencies | 4 ++++ setup | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pip_dependencies b/pip_dependencies index e132fca..2e16756 100644 --- a/pip_dependencies +++ b/pip_dependencies @@ -1,3 +1,7 @@ flask netifaces colorama +scapy +netaddr +pexpect +wifi diff --git a/setup b/setup index b9880f7..5ddb29f 100755 --- a/setup +++ b/setup @@ -1,6 +1,4 @@ apt-get update -apt-get install -y python-flask -apt-get install -y python-pip apt-get install -y git-core apt-get install -y postgresql apt-get install -y python-dev @@ -15,12 +13,6 @@ python setup.py install cd .. apt install -y python-nmap pip install --upgrade pip -pip install scapy -pip install netaddr -pip install pexpect -pip install wifi -apt-get install -y python-netifaces -pip install colorama apt-get install -y python-psycopg2 apt-get install -y python-tk python setup_postgres.py From bc145bfced99f955e46690050ff5bf9edfe8ec5b Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 01:47:15 +0000 Subject: [PATCH 11/21] More pip dependencies --- pip_dependencies | 1 + setup | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pip_dependencies b/pip_dependencies index 2e16756..1ba7f30 100644 --- a/pip_dependencies +++ b/pip_dependencies @@ -5,3 +5,4 @@ scapy netaddr pexpect wifi +psycopg2 diff --git a/setup b/setup index 5ddb29f..1d7bbe1 100755 --- a/setup +++ b/setup @@ -13,7 +13,6 @@ python setup.py install cd .. apt install -y python-nmap pip install --upgrade pip -apt-get install -y python-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 From bb56e35d240fdaa33b92769bb178d3d052f204ab Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 01:57:46 +0000 Subject: [PATCH 12/21] Added python-wifi --- pip_dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/pip_dependencies b/pip_dependencies index 1ba7f30..836d803 100644 --- a/pip_dependencies +++ b/pip_dependencies @@ -5,4 +5,5 @@ scapy netaddr pexpect wifi +python-wifi psycopg2 From 237749bb11d070c7aa231fdfd5092ebabce44cf7 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 21:03:31 -0500 Subject: [PATCH 13/21] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5b0b985..102d934 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,6 @@ python: - "2.7" install: - pip install -r pip_dependencies + - sudo pip install -r pip_dependencies - sudo -H ./setup script: nosetests -vv --nocapture From 859fa90d5e8154c0be0dadf69736f4deadc7cf51 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 02:06:21 +0000 Subject: [PATCH 14/21] Added pycrypto --- pip_dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/pip_dependencies b/pip_dependencies index 836d803..26158a3 100644 --- a/pip_dependencies +++ b/pip_dependencies @@ -7,3 +7,4 @@ pexpect wifi python-wifi psycopg2 +pycrypto From a0bb7dec39dbbd1010ec9c1dfb15695830187a76 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 02:12:31 +0000 Subject: [PATCH 15/21] Created first simple test --- tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests.py b/tests.py index d923497..6b819da 100644 --- a/tests.py +++ b/tests.py @@ -1,2 +1,4 @@ +import os + def base_test(): - pass + os.system("python cli.py") From 2a5db0cf1d99d2da3dcf458ee7ce784322510552 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 21:16:21 -0500 Subject: [PATCH 16/21] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 102d934..e6f93b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,4 @@ install: - pip install -r pip_dependencies - sudo pip install -r pip_dependencies - sudo -H ./setup -script: nosetests -vv --nocapture +script: sudo nosetests -vv --nocapture From e96cafc36035d8b81ce58402478efc57cde78da8 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 21:22:50 -0500 Subject: [PATCH 17/21] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e6f93b9..5424bd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,5 @@ install: - pip install -r pip_dependencies - sudo pip install -r pip_dependencies - sudo -H ./setup + - sudo apt install nosetests script: sudo nosetests -vv --nocapture From 5ce691adbee8d9796027ccaf1a4c9f188cbb5e0a Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 02:28:08 +0000 Subject: [PATCH 18/21] Added nose --- .travis.yml | 1 - pip_dependencies | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5424bd6..e6f93b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,4 @@ install: - pip install -r pip_dependencies - sudo pip install -r pip_dependencies - sudo -H ./setup - - sudo apt install nosetests script: sudo nosetests -vv --nocapture diff --git a/pip_dependencies b/pip_dependencies index 26158a3..2e5b8e6 100644 --- a/pip_dependencies +++ b/pip_dependencies @@ -8,3 +8,4 @@ wifi python-wifi psycopg2 pycrypto +nose From 51903e5295d372ce59065eb51dbbc7f7a8a690a3 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 02:38:44 +0000 Subject: [PATCH 19/21] Fixed tests --- tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests.py b/tests.py index 6b819da..92d89ec 100644 --- a/tests.py +++ b/tests.py @@ -1,4 +1,11 @@ import os +import pexpect +from colorama import * +import re + +prompt = Fore.BLUE + ">> " + Fore.RESET def base_test(): - os.system("python cli.py") + cli = pexpect.spawn("sudo python cli.py") + cli.expect(re.escape(prompt)) + From 6ebd92203a805dafeb37b4a5778ce20c3428f577 Mon Sep 17 00:00:00 2001 From: ecthros Date: Mon, 21 Nov 2016 21:55:56 -0500 Subject: [PATCH 20/21] Update network.py --- network.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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): From 80da1a8336ef263cfe7ec9dcbfa67d7346dcf4f3 Mon Sep 17 00:00:00 2001 From: George Hughey Date: Tue, 22 Nov 2016 03:11:10 +0000 Subject: [PATCH 21/21] Added wifi scanning --- core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 = []