Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ecthros/pina-colada
Browse files Browse the repository at this point in the history
  • Loading branch information
Srujan Thotapally committed Nov 27, 2016
2 parents eaaff28 + 80da1a8 commit c74f0b0
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 = []
Expand Down
21 changes: 21 additions & 0 deletions network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions pip_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
flask
netifaces
colorama
scapy
netaddr
pexpect
wifi
python-wifi
psycopg2
pycrypto
nose
9 changes: 1 addition & 8 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit c74f0b0

Please sign in to comment.