本文整理汇总了Python中Core.Utils.Refactor.set_ip_forward方法的典型用法代码示例。如果您正苦于以下问题:Python Refactor.set_ip_forward方法的具体用法?Python Refactor.set_ip_forward怎么用?Python Refactor.set_ip_forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Utils.Refactor
的用法示例。
在下文中一共展示了Refactor.set_ip_forward方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: kill
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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)
示例2: Start_Attack
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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')
示例3: kill
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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)
示例4: closeEvent
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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()
示例5: kill
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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
示例6: kill
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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
示例7: CoreSettings
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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()
示例8: CoreSettings
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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()
示例9: CoreSettings
# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import set_ip_forward [as 别名]
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()