def disableInternetConnection(self): ipaddress = str(self.comboxBoxIPAddress.currentText()) exec_bash('iptables -D FORWARD -s {ip} -j ACCEPT'.format(ip=ipaddress)) exec_bash('iptables -I FORWARD -s {ip} -j REJECT'.format(ip=ipaddress)) self.btnEnable.setEnabled(True) self.btncancel.setEnabled(False) self.ClientsLogged[ipaddress]['Status'] = False self.logger_portal.addItem( 'Deny access the internet to {}'.format(ipaddress))
def configure_network_AP(self): ''' configure interface and dhcpd for mount Access Point ''' self.SettingsEnable['PortRedirect'] = self.FSettings.Settings.get_setting('settings','redirect_port') print('[*] Enable forwarding in iptables...') Refactor.set_ip_forward(1) # clean iptables settings for line in self.SettingsAP['kill']: exec_bash(line) # set interface using ifconfig for line in self.SettingsAP['interface']: exec_bash(line) # check if dhcp option is enabled. if self.FSettings.Settings.get_setting('accesspoint','dhcp_server',format=bool): with open(C.DHCPCONF_PATH,'w') as dhcp: for line in self.SettingsAP['dhcp-server']:dhcp.write(line) dhcp.close() if not path.isdir('/etc/dhcp/'): mkdir('/etc/dhcp') move(C.DHCPCONF_PATH, '/etc/dhcp/')
def stop_access_point(self): ''' stop all thread :Access point attack and restore all settings ''' if self.Apthreads['RogueAP'] == []: return print('-------------------------------') self.proxy.Stop() self.mitmhandler.Stop() self.dnsserver.Stop() self.dhcpcontrol.Stop() self.wireless.Stop() self.SessionConfig.DHCP.setEnabled(True) self.SessionConfig.DNSSettings.setEnabled(True) self.proxy.setEnabled(True) self.mitmhandler.setEnabled(True) self.FSettings.Settings.set_setting('accesspoint', 'statusAP', False) #TODO Fix this #self.FSettings.Settings.set_setting('accesspoint','bssid',str(self.EditBSSID.text())) self.SessionsAP[self.currentSessionID]['stoped'] = asctime() self.FSettings.Settings.set_setting('accesspoint', 'sessions', dumps(self.SessionsAP)) try: for thread in self.Apthreads['RogueAP']: thread.stop() self.FSettings.Settings.set_setting('runningconfig', 'totalthread', 0) except Exception: pass # remove iptables commands and stop dhcpd if pesist in process for kill in self.SettingsAP['kill']: exec_bash(kill) # stop time count self.Home.APStatus.stop_timer() set_monitor_mode(self.SettingsEnable['AP_iface']).setDisable() self.set_status_label_AP(False) self.progress.setValue(1) self.progress.change_color('') self.progress.setText('') self.connectedCount.setText('0') self.Apthreads['RogueAP'] = [] self.APclients = {} self.btn_cancelar.setEnabled(False) self.btn_start_attack.setEnabled(True) self.progress.showProcessBar()