コード例 #1
0
 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)
コード例 #2
0
ファイル: Main.py プロジェクト: BrunoDB/WiFi-Pumpkin
 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)
コード例 #3
0
ファイル: ArpPosion.py プロジェクト: apcwowo/WiFi-Pumpkin
    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')
コード例 #4
0
ファイル: Main.py プロジェクト: MGKhKhD/WiFi-Pumpkin
 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)
コード例 #5
0
ファイル: ArpPosion.py プロジェクト: Neykl/WiFi-Pumpkin
    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')
コード例 #6
0
ファイル: ArpPosion.py プロジェクト: apcwowo/WiFi-Pumpkin
 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()
コード例 #7
0
ファイル: ArpPosion.py プロジェクト: Neykl/WiFi-Pumpkin
 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()
コード例 #8
0
ファイル: Main.py プロジェクト: Neykl/WiFi-Pumpkin
 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
コード例 #9
0
ファイル: Main.py プロジェクト: yoCruzer/WiFi-Pumpkin
 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
コード例 #10
0
ファイル: Main.py プロジェクト: tUn4/WiFi-Pumpkin
 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)
コード例 #11
0
ファイル: Main.py プロジェクト: apcwowo/WiFi-Pumpkin
 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
コード例 #12
0
ファイル: Main.py プロジェクト: BrunoDB/WiFi-Pumpkin
 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()
コード例 #13
0
ファイル: Main.py プロジェクト: apcwowo/WiFi-Pumpkin
 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()
コード例 #14
0
ファイル: Main.py プロジェクト: Neykl/WiFi-Pumpkin
 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()
コード例 #15
0
 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()
コード例 #16
0
ファイル: Main.py プロジェクト: yoCruzer/WiFi-Pumpkin
 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()