Skip to content

Commit

Permalink
Integrated master and network
Browse files Browse the repository at this point in the history
  • Loading branch information
ecthros committed Oct 24, 2016
1 parent 62defa9 commit 50a3a3f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 39 deletions.
5 changes: 5 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import traceback
import netifaces as ni
import core
from sniff import *
from network import *

from colorama import *
from Tkinter import *
Expand All @@ -25,6 +27,9 @@ def __init__(self):
self.ctrlc = False
ascii()
print "Welcome to Pina Colada, a powerful Wifi Pineapple. Type \"help\" to see the list of available commands."
print "Packets are being stored in the packets directory."
start_sniffing()
init_network()

def print_help(self, lst):
it = iter(lst)
Expand Down
4 changes: 2 additions & 2 deletions master.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import subprocess
from network import *
from scapy import *
from packets/sniff import *
from sniff import *
import time

if __name__ == "__main__":
if os.getuid() != 0:
print "Please run me as root!"
sys.exit()
start_sniffing()
init_scan()
init_network()
time.sleep(3600)
22 changes: 19 additions & 3 deletions network.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ def __init__(self):
self.profile()
self.connect()

def init_scan():
thisComp = Network()
def begin_scan(thisComp, portLow, portHigh):
for comp in thisComp.comps:
ports = syn_scan(comp.ip, (0,1000))
ports = syn_scan(comp.ip, (portLow, portHigh))
ports = ','.join(ports)
ts = time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
Expand All @@ -70,3 +69,20 @@ def init_scan():
.format(st, network, network, st, network))
thisComp.conn.commit()
thisComp.cur.close()
return thisComp

def init_network():
print "Initializing Network DB..."
thisComp = Network()

try:
thread.start_new_thread(begin_scan, (thisComp, 22, 22))
except Exception as e:
print "Thread creation failed :("
print e


return thisComp



33 changes: 0 additions & 33 deletions packets/sniff.py

This file was deleted.

1 change: 0 additions & 1 deletion scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def slow_syn_scan(host, ports):

#This is a fast syn scan.
def syn_scan(target, ports):
print "Beginning Scan...\n"
ans,unans = sr(IP(dst=target)/TCP(dport=ports),timeout=.1,verbose=0)
rep = []
for s,r in ans:
Expand Down

0 comments on commit 50a3a3f

Please sign in to comment.