本文整理汇总了Python中Modules.utils.Refactor.set_ip_forward方法的典型用法代码示例。如果您正苦于以下问题:Python Refactor.set_ip_forward方法的具体用法?Python Refactor.set_ip_forward怎么用?Python Refactor.set_ip_forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules.utils.Refactor
的用法示例。
在下文中一共展示了Refactor.set_ip_forward方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Start_Attack
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.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')
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()
self.conf_attack(True)
redirectPackets = ThSpoofAttack('',
str(self.ComboIface.currentText()),'udp port 53',True,str(self.txt_redirect.text()))
self.connect(redirectPackets,SIGNAL('Activated ( QString ) '), self.StopArpAttack)
redirectPackets.setObjectName('Packets Spoof')
self.ThreadDirc['Arp_posion'].append(redirectPackets)
redirectPackets.start()
示例2: CoreSettings
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.utils.Refactor import set_ip_forward [as 别名]
def CoreSettings(self):
range_dhcp = self.FSettings.xmlSettings('Iprange', 'range',None,False)
self.PortRedirect = self.FSettings.xmlSettings('redirect', 'port',None,False)
self.SettingsAP = {
'interface':
[
'ifconfig %s up'%(self.Ap_iface),
'ifconfig %s 10.0.0.1 netmask 255.255.255.0'%(self.Ap_iface),
'ifconfig %s mtu 1400'%(self.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',
'killall dhpcd',
'killall dnsmasq'
],
'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.Ap_iface),
'dhcp-range=10.0.0.10,10.0.0.50,12h\n',
'dhcp-option=3, 10.0.0.1\n',
'dhcp-option=6, 10.0.0.1\n',
'no-hosts\n'
'addn-hosts='+ getcwd() + '/Settings/dnsmasq.hosts\n'
]
}
Refactor.set_ip_forward(1)
for i in self.SettingsAP['interface']:popen(i)
for i in self.SettingsAP['kill']: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')
move('Settings/dhcpd.conf', '/etc/dhcp/')
else:
with open('Settings/dnsmasq.conf','w') as dhcp:
for i in self.SettingsAP['dnsmasq']:
dhcp.write(i)
dhcp.close()
示例3: kill
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.utils.Refactor import set_ip_forward [as 别名]
def kill(self):
if self.Apthreads['RougeAP'] == []:return
for i in self.Apthreads['RougeAP']:i.stop()
for kill in self.SettingsAP['kill']:popen(kill)
set_monitor_mode(self.interface).setDisable()
self.Started(False)
Refactor.set_ip_forward(0)
self.ListLoggerDhcp.clear()
示例4: kill_attack
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.utils.Refactor import set_ip_forward [as 别名]
def kill_attack(self):
try:
for i in self.ThreadDirc['Arp_posion']:i.stop()
self.Ftemplates.killThread()
except:pass
chdir(self.owd)
self.StatusMonitor(False,'stas_arp')
self.StatusMonitor(False,'stas_phishing')
self.conf_attack(False)
Refactor.set_ip_forward(0)
示例5: kill
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.utils.Refactor import set_ip_forward [as 别名]
def kill(self):
if self.Apthreads['RougeAP'] == []:return
for i in self.Apthreads['RougeAP']:i.stop()
terminate = [
'killall dhcpd',
'killall dnsmasq'
'killall xterm',
'iptables --flush',
'iptables --table nat --flush',
'iptables --delete-chain',
'iptables --table nat --delete-chain']
for delete in terminate:popen(delete)
set_monitor_mode(self.interface).setDisable()
self.Started(False)
Refactor.set_ip_forward(0)
self.ListLoggerDhcp.clear()
示例6: Start_Attack
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.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')
Refactor.set_ip_forward(1)
self.conf_attack(True)
thr = ThreadAttackPosion(str(self.txt_target.text()),
str(self.txt_gateway.text()),
str(self.txt_mac.text()))
self.connect(thr,SIGNAL('Activated ( QString ) '), self.StopArpAttack)
thr.setObjectName('Arp Posion')
self.ThreadDirc['Arp_posion'].append(thr)
thr.start()
示例7: kill
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.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
示例8: CoreSettings
# 需要导入模块: from Modules.utils import Refactor [as 别名]
# 或者: from Modules.utils.Refactor import set_ip_forward [as 别名]
def CoreSettings(self):
range_dhcp = self.FSettings.xmlSettings("Iprange", "range", None, False)
self.PortRedirect = self.FSettings.xmlSettings("redirect", "port", None, False)
self.SettingsAP = {
"interface": [
"ifconfig %s up" % (self.Ap_iface),
"ifconfig %s 10.0.0.1 netmask 255.255.255.0" % (self.Ap_iface),
"ifconfig %s mtu 1400" % (self.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",
"killall dhpcd",
"killall dnsmasq",
],
"hostapd": [
"interface={}\n".format(str(self.selectCard.currentText())),
"driver=nl80211\n",
"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.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",
"addn-hosts=" + getcwd() + "/Settings/dnsmasq.hosts\n",
],
}
Refactor.set_ip_forward(1)
for i in self.SettingsAP["interface"]:
popen(i)
for i in self.SettingsAP["kill"]:
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("Settings/dnsmasq.conf", "w") as dhcp:
for i in self.SettingsAP["dnsmasq"]:
dhcp.write(i)
dhcp.close()