本文整理汇总了Python中Core.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')
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')
示例2: kill
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)
示例3: kill
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)
示例4: discoveryIface
def discoveryIface(self):
iface = str(self.ComboIface.currentText())
mac = Refactor.getHwAddr(iface)
ip = Refactor.get_Ipaddr(iface)
if self.configure.xmlSettings('statusAP','value',None,False) == 'True':
self.txt_gateway.setText('10.0.0.1')
self.txt_mac.setText(mac)
self.txt_redirect.setText(ip)
示例5: working
def working(self,ip,lista):
with open(devnull, 'wb') as limbo:
result=Popen(['ping', '-c', '1', '-n', '-W', '1', ip],
stdout=limbo, stderr=limbo).wait()
if not result:
if Refactor.get_mac(ip) == None:
lista[ip] = ip + '|' + 'not found'
else:
lista[ip] = ip + '|' + Refactor.get_mac(ip)
示例6: 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('wl',j):
self.ComboIface.addItem(n[i])
self.discoveryIface()
示例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: __init__
def __init__(self,parent=None,*args):
super(PumpkinModule, self).__init__(parent)
self.setWindowIcon(QIcon('Icons/icon.ico'))
self.module_network = Refactor
self.configure = frm_Settings()
self.Ftemplates = frm_PhishingManager()
self.interfaces = Refactor.get_interfaces()
示例9: closeEvent
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()
示例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["HTML"]), filehtml.close()
QMessageBox.information(self, "WiFi Pumpkin", "file has been saved with success.")
示例11: GetDHCPRequests
def GetDHCPRequests(self,data):
if len(data) == 8:
if Refactor.check_is_mac(data[4]):
if data[4] not in self.APclients.keys():
self.APclients[data[4]] = {'IP': data[2],
'device': sub(r'[)|(]',r'',data[5]),'in_tables': False,}
self.StatusDHCPRequests(data[4],self.APclients[data[4]])
elif len(data) == 9:
if Refactor.check_is_mac(data[5]):
if data[5] not in self.APclients.keys():
self.APclients[data[5]] = {'IP': data[2],
'device': sub(r'[)|(]',r'',data[6]),'in_tables': False,}
self.StatusDHCPRequests(data[5],self.APclients[data[5]])
elif len(data) == 7:
if Refactor.check_is_mac(data[4]):
if data[4] not in self.APclients.keys():
leases = IscDhcpLeases('/var/lib/dhcp/dhcpd.leases')
hostname = None
try:
for item in leases.get():
if item.ethernet == data[4]:
hostname = item.hostname
if hostname == None:
item = leases.get_current()
hostname = item[data[4]]
except:
hostname = 'unknown'
if hostname == None:hostname = 'unknown'
self.APclients[data[4]] = {'IP': data[2],'device': hostname,
'in_tables': False,}
self.StatusDHCPRequests(data[4],self.APclients[data[4]])
Headers = []
for mac in self.APclients.keys():
if self.APclients[mac]['in_tables'] == False:
self.APclients[mac]['in_tables'] = True
self.THeaders['mac-address'].append(mac)
self.THeaders['ip-address'].append(self.APclients[mac]['IP'])
self.THeaders['device'].append(self.APclients[mac]['device'])
for n, key in enumerate(self.THeaders.keys()):
Headers.append(key)
for m, item in enumerate(self.THeaders[key]):
item = QTableWidgetItem(item)
item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter)
self.TabInfoAP.setItem(m, n, item)
self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys())
self.connectedCount.setText(str(len(self.APclients.keys())))
示例12: GetloggerInjection
def GetloggerInjection(self,data):
if Refactor.getSize('Logs/AccessPoint/injectionPage.log') > 255790:
with open('Logs/AccessPoint/injectionPage.log','w') as bufferlog:
bufferlog.write(''), bufferlog.close()
if data not in self.urlinjected:
self.log_inject.addItem(data)
self.urlinjected.append(data)
self.log_inject.scrollToBottom()
示例13: 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['HTML']),filehtml.close()
QMessageBox.information(self, 'WiFi Pumpkin', 'file has been saved with success.')
示例14: GetDHCPRequests
def GetDHCPRequests(self, data):
if len(data) == 8:
if Refactor.check_is_mac(data[4]):
if data[4] not in self.APclients.keys():
self.APclients[data[4]] = {"IP": data[2], "device": data[5], "in_tables": False}
self.StatusDHCPRequests(data[4])
elif len(data) == 9:
if Refactor.check_is_mac(data[5]):
if data[5] not in self.APclients.keys():
self.APclients[data[5]] = {"IP": data[2], "device": data[6], "in_tables": False}
self.StatusDHCPRequests(data[5])
elif len(data) == 7:
if Refactor.check_is_mac(data[4]):
if data[4] not in self.APclients.keys():
leases = IscDhcpLeases("Settings/dhcp/dhcpd.leases")
hostname = None
try:
for item in leases.get():
if item.ethernet == data[4]:
hostname = item.hostname
if hostname == None:
item = leases.get_current()
hostname = item[data[4]]
except:
hostname = "unknown"
if hostname == None:
hostname = "unknown"
self.APclients[data[4]] = {"IP": data[2], "device": hostname, "in_tables": False}
self.StatusDHCPRequests(data[4])
self.APclients[data[4]] = {"IP": data[2], "device": hostname, "in_tables": False}
Headers = []
for mac in self.APclients.keys():
if self.APclients[mac]["in_tables"] == False:
self.APclients[mac]["in_tables"] = True
self.THeaders["mac-address"].append(mac)
self.THeaders["ip-address"].append(self.APclients[mac]["IP"])
self.THeaders["device"].append(self.APclients[mac]["device"])
for n, key in enumerate(self.THeaders.keys()):
Headers.append(key)
for m, item in enumerate(self.THeaders[key]):
item = QTableWidgetItem(item)
item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter)
self.TabInfoAP.setItem(m, n, item)
self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys())
self.connectedCount.setText(str(len(self.APclients.keys())))
示例15: list_clicked
def list_clicked(self, index):
itms = self.list.selectedIndexes()
for i in itms:
attack = str(i.data().toString()).split()
for i in attack:
if Refactor.check_is_mac(i.replace(" ", "")):
self.linetarget.setText(str(i))
if self.linetarget.text() == "":
QMessageBox.information(self, "MacAddress", "Error check the Mac Target, please set the mac valid.")