def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self, "Error interface", "Network interface not supported :(") if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self, "Error Gateway", "gateway not found") if not self.ConfigTwin["ProgCheck"][5]: return QMessageBox.information(self, "Error Hostapd", "hostapd not installed") dhcp_select = self.FSettings.xmlSettings("dhcp", "dhcp_server", None, False) if dhcp_select == "iscdhcpserver": if not self.ConfigTwin["ProgCheck"][3]: return QMessageBox.warning(self, "Error dhcp", "isc-dhcp-server not installed") elif dhcp_select == "dnsmasq": if not self.ConfigTwin["ProgCheck"][4]: return QMessageBox.information(self, "Error dhcp", "dnsmasq not installed") if str(Refactor.get_interfaces()["activated"]).startswith("wlan"): return QMessageBox.information( self, "Error network card", "You are connected with interface wireless, try again with local connection" ) self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings("accesspoint", "actived", None, False) if self.APactived == "airbase-ng": self.ConfigTwin["interface"] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings("interface", "monitor_mode", self.ConfigTwin["interface"], False) # airbase thread Thread_airbase = ProcessThread( [ "airbase-ng", "-c", str(self.EditChannel.text()), "-e", self.EditApName.text(), "-F", "Logs/Caplog/" + asctime(), self.ConfigTwin["interface"], ] ) Thread_airbase.name = "Airbase-ng" self.Apthreads["RougeAP"].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin["AP_iface"] = [x for x in Refactor.get_interfaces()["all"] if search("at", x)][0] self.FSettings.xmlSettings("netcreds", "interface", self.ConfigTwin["AP_iface"], False) break self.CoreSettings() elif self.APactived == "hostapd": self.FSettings.xmlSettings("netcreds", "interface", str(self.selectCard.currentText()), False) self.ConfigTwin["AP_iface"] = str(self.selectCard.currentText()) try: check_output(["nmcli", "radio", "wifi", "off"]) except CalledProcessError: try: check_output(["nmcli", "nm", "wifi", "off"]) except CalledProcessError as e: return QMessageBox.warning(self, "Error nmcli", e) call(["rfkill", "unblock", "wlan"]) self.CoreSettings() ignore = ("interface=", "ssid=", "channel=") with open("Settings/hostapd.conf", "w") as apconf: for i in self.SettingsAP["hostapd"]: apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split("\n"): if not config.startswith("#") and len(config) > 0: if not config.startswith(ignore): apconf.write(config + "\n") apconf.close() self.Thread_hostapd = ProcessHostapd(["hostapd", "-d", "Settings/hostapd.conf"]) self.Thread_hostapd.setObjectName("hostapd") self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads["RougeAP"].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings("dhcp", "dhcp_server", None, False) if selected_dhcp == "iscdhcpserver": Thread_dhcp = ThRunDhcp( [ "sudo", "dhcpd", "-d", "-f", "-lf", "Settings/dhcp/dhcpd.leases", "-cf", "/etc/dhcp/dhcpd.conf", self.ConfigTwin["AP_iface"], ] ) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName("DHCP") self.Apthreads["RougeAP"].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else: return QMessageBox.information(self, "DHCP", selected_dhcp + " not found.") self.Started(True) self.FSettings.xmlSettings("statusAP", "value", "True", False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen("iptables -t nat -A PREROUTING -p udp -j DNAT --to {}".format(str(self.EditGateway.text()))) self.FSettings.xmlSettings("sslstrip_plugin", "status", "False", False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules("sslstrip") # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.ConfigTwin["PortRedirect"]) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads["RougeAP"].append(Thread_sslstrip) Thread_sslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread( [ "python", "Plugins/net-creds/net-creds.py", "-i", self.FSettings.xmlSettings("netcreds", "interface", None, False), ] ) Thread_netcreds.setName("Net-Creds") self.Apthreads["RougeAP"].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(["python", "Plugins/dns2proxy/dns2proxy.py"]) Thread_dns2proxy.setName("Dns2Proxy") self.Apthreads["RougeAP"].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search("--append FORWARD --in-interface", rules): popen(rules.replace("$$", self.ConfigTwin["AP_iface"])) elif search("--append POSTROUTING --out-interface", rules): popen(rules.replace("$$", str(Refactor.get_interfaces()["activated"]))) else: popen(rules)
class SubMain(QWidget): def __init__(self, parent=None): super(SubMain, self).__init__(parent) # self.create_sys_tray() self.Main = QVBoxLayout() self.Apthreads = {"RougeAP": []} self.APclients = {} self.ConfigTwin = {"ProgCheck": [], "AP_iface": None, "PortRedirect": None, "interface": "None"} self.THeaders = {"ip-address": [], "device": [], "mac-address": []} self.FSettings = frm_Settings() self.PopUpPlugins = PopUpPlugins(self.FSettings) self.setGeometry(0, 0, 300, 400) self.checkPlugins() self.intGUI() def intGUI(self): self.myQMenuBar = QMenuBar(self) self.myQMenuBar.setFixedWidth(400) self.StatusBar = QStatusBar() self.StatusBar.setFixedHeight(15) self.StatusBar.addWidget(QLabel("::Access|Point::")) self.StatusDhcp = QLabel("") self.connectedCount = QLabel("") self.StatusDhcp = QLabel("") self.StatusBar.addWidget(self.StatusDhcp) self.Started(False) self.StatusBar.addWidget(QLabel(" " * 21)) self.StatusBar.addWidget(QLabel("::Clients::")) self.connectedCount.setText("0") self.connectedCount.setStyleSheet("QLabel { color : yellow; }") self.StatusBar.addWidget(self.connectedCount) Menu_file = self.myQMenuBar.addMenu("&File") exportAction = QAction("Export Html", self) deleteAction = QAction("Clear Logger", self) exitAction = QAction("Exit", self) exitAction.setIcon(QIcon("rsc/close-pressed.png")) deleteAction.setIcon(QIcon("rsc/delete.png")) exportAction.setIcon(QIcon("rsc/export.png")) Menu_file.addAction(exportAction) Menu_file.addAction(deleteAction) Menu_file.addAction(exitAction) exitAction.triggered.connect(exit) deleteAction.triggered.connect(self.delete_logger) exportAction.triggered.connect(self.exportHTML) Menu_View = self.myQMenuBar.addMenu("&View") phishinglog = QAction("Monitor Phishing", self) netcredslog = QAction("Monitor NetCreds", self) dns2proxylog = QAction("Monitor Dns2proxy", self) # connect phishinglog.triggered.connect(self.credentials) netcredslog.triggered.connect(self.logsnetcreds) dns2proxylog.triggered.connect(self.logdns2proxy) # icons phishinglog.setIcon(QIcon("rsc/password.png")) netcredslog.setIcon(QIcon("rsc/logger.png")) dns2proxylog.setIcon(QIcon("rsc/proxy.png")) Menu_View.addAction(phishinglog) Menu_View.addAction(netcredslog) Menu_View.addAction(dns2proxylog) # tools Menu Menu_tools = self.myQMenuBar.addMenu("&Tools") ettercap = QAction("Active Ettercap", self) btn_drift = QAction("Active DriftNet", self) btn_drift.setShortcut("Ctrl+Y") ettercap.setShortcut("Ctrl+E") ettercap.triggered.connect(self.start_etter) btn_drift.triggered.connect(self.start_dift) # icons tools ettercap.setIcon(QIcon("rsc/ettercap.png")) btn_drift.setIcon(QIcon("rsc/capture.png")) Menu_tools.addAction(ettercap) Menu_tools.addAction(btn_drift) # menu module Menu_module = self.myQMenuBar.addMenu("&Modules") btn_deauth = QAction("Deauth Attack", self) btn_probe = QAction("Probe Request", self) btn_mac = QAction("Mac Changer", self) btn_dhcpStar = QAction("DHCP S. Attack", self) btn_winup = QAction("Windows Update", self) btn_arp = QAction("Arp Posion Attack", self) btn_dns = QAction("Dns Spoof Attack", self) btn_phishing = QAction("Phishing Manager", self) action_settings = QAction("Settings", self) # Shortcut modules btn_deauth.setShortcut("Ctrl+W") btn_probe.setShortcut("Ctrl+K") btn_mac.setShortcut("Ctrl+M") btn_dhcpStar.setShortcut("Ctrl+H") btn_winup.setShortcut("Ctrl+N") btn_dns.setShortcut("ctrl+D") btn_arp.setShortcut("ctrl+Q") btn_phishing.setShortcut("ctrl+Z") action_settings.setShortcut("Ctrl+X") # connect buttons btn_probe.triggered.connect(self.showProbe) btn_deauth.triggered.connect(self.formDauth) btn_mac.triggered.connect(self.form_mac) btn_dhcpStar.triggered.connect(self.show_dhcpDOS) btn_winup.triggered.connect(self.show_windows_update) btn_arp.triggered.connect(self.show_arp_posion) btn_dns.triggered.connect(self.show_dns_spoof) btn_phishing.triggered.connect(self.show_PhishingManager) action_settings.triggered.connect(self.show_settings) # icons Modules btn_arp.setIcon(QIcon("rsc/arp_.png")) btn_winup.setIcon(QIcon("rsc/arp.png")) btn_dhcpStar.setIcon(QIcon("rsc/dhcp.png")) btn_mac.setIcon(QIcon("rsc/mac.png")) btn_probe.setIcon(QIcon("rsc/probe.png")) btn_deauth.setIcon(QIcon("rsc/deauth.png")) btn_dns.setIcon(QIcon("rsc/dns_spoof.png")) btn_phishing.setIcon(QIcon("rsc/page.png")) action_settings.setIcon(QIcon("rsc/setting.png")) # add modules menu Menu_module.addAction(btn_deauth) Menu_module.addAction(btn_probe) Menu_module.addAction(btn_mac) Menu_module.addAction(btn_dhcpStar) Menu_module.addAction(btn_winup) Menu_module.addAction(btn_arp) Menu_module.addAction(btn_dns) Menu_module.addAction(btn_phishing) Menu_module.addAction(action_settings) # menu extra Menu_extra = self.myQMenuBar.addMenu("&Help") Menu_update = QAction("Update", self) Menu_about = QAction("About", self) Menu_issue = QAction("Submit issue", self) Menu_about.setIcon(QIcon("rsc/about.png")) Menu_issue.setIcon(QIcon("rsc/report.png")) Menu_update.setIcon(QIcon("rsc/update.png")) Menu_about.triggered.connect(self.about) Menu_issue.triggered.connect(self.issue) Menu_update.triggered.connect(self.show_update) Menu_extra.addAction(Menu_issue) Menu_extra.addAction(Menu_update) Menu_extra.addAction(Menu_about) self.EditGateway = QLineEdit(self) self.EditApName = QLineEdit(self) self.EditChannel = QLineEdit(self) self.selectCard = QComboBox(self) self.EditGateway.setFixedWidth(120) self.EditApName.setFixedWidth(120) self.EditChannel.setFixedWidth(120) # table information AP connected self.TabInfoAP = QTableWidget(5, 3) self.TabInfoAP.setRowCount(100) self.TabInfoAP.setFixedHeight(150) self.TabInfoAP.setSelectionBehavior(QAbstractItemView.SelectRows) self.TabInfoAP.setEditTriggers(QAbstractItemView.NoEditTriggers) self.TabInfoAP.resizeColumnsToContents() self.TabInfoAP.resizeRowsToContents() self.TabInfoAP.horizontalHeader().resizeSection(0, 90) self.TabInfoAP.horizontalHeader().resizeSection(1, 120) self.TabInfoAP.horizontalHeader().resizeSection(2, 100) self.TabInfoAP.verticalHeader().setVisible(False) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) # edits self.mConfigure() self.FormGroup1 = QFormLayout() self.FormGroup2 = QFormLayout() self.FormGroup3 = QFormLayout() # get logo vbox = QVBoxLayout() vbox.setMargin(5) vbox.addStretch(20) self.FormGroup1.addRow(vbox) self.logo = QPixmap(getcwd() + "/rsc/logo.png") # self.logo. self.imagem = QLabel(self) self.imagem.setPixmap(self.logo) self.FormGroup1.addRow(self.imagem) # popup settings self.btnPlugins = QToolButton(self) self.btnPlugins.setFixedHeight(25) self.btnPlugins.setIcon(QIcon("rsc/plugins.png")) self.btnPlugins.setText("[::Plugins::]") self.btnPlugins.setPopupMode(QToolButton.MenuButtonPopup) self.btnPlugins.setMenu(QMenu(self.btnPlugins)) action = QWidgetAction(self.btnPlugins) action.setDefaultWidget(self.PopUpPlugins) self.btnPlugins.menu().addAction(action) self.btnHttpServer = QToolButton(self) self.btnHttpServer.setFixedHeight(25) self.btnHttpServer.setIcon(QIcon("rsc/phishing.png")) self.FormPopup = PopUpServer(self.FSettings) self.btnHttpServer.setPopupMode(QToolButton.MenuButtonPopup) self.btnHttpServer.setMenu(QMenu(self.btnHttpServer)) action = QWidgetAction(self.btnHttpServer) action.setDefaultWidget(self.FormPopup) self.btnHttpServer.menu().addAction(action) self.GroupAP = QGroupBox() self.GroupAP.setTitle("Access Point::") self.FormGroup3.addRow("Gateway:", self.EditGateway) self.FormGroup3.addRow("AP Name:", self.EditApName) self.FormGroup3.addRow("Channel:", self.EditChannel) self.GroupAP.setLayout(self.FormGroup3) # grid network adapter fix self.btrn_refresh = QPushButton("Refresh") self.btrn_refresh.setIcon(QIcon("rsc/refresh.png")) self.btrn_refresh.clicked.connect(self.refrash_interface) self.layout = QFormLayout() self.GroupAdapter = QGroupBox() self.GroupAdapter.setFixedWidth(120) self.GroupAdapter.setTitle("Network Adapter::") self.layout.addRow(self.selectCard) self.layout.addRow(self.btrn_refresh) self.layout.addRow(self.btnPlugins, self.btnHttpServer) self.GroupAdapter.setLayout(self.layout) self.btn_start_attack = QPushButton("Start Access Point", self) self.btn_start_attack.setIcon(QIcon("rsc/start.png")) self.btn_cancelar = QPushButton("Stop Access Point", self) self.btn_cancelar.setIcon(QIcon("rsc/Stop.png")) self.btn_cancelar.clicked.connect(self.kill) self.btn_start_attack.clicked.connect(self.StartApFake) hBox = QHBoxLayout() hBox.addWidget(self.btn_start_attack) hBox.addWidget(self.btn_cancelar) self.slipt = QHBoxLayout() self.slipt.addWidget(self.GroupAP) self.slipt.addWidget(self.GroupAdapter) self.FormGroup2.addRow(hBox) self.FormGroup2.addRow(self.TabInfoAP) self.FormGroup2.addRow(self.StatusBar) self.Main.addLayout(self.FormGroup1) self.Main.addLayout(self.slipt) self.Main.addLayout(self.FormGroup2) self.setLayout(self.Main) def show_arp_posion(self): self.Farp_posion = frm_Arp_Poison() self.Farp_posion.setGeometry(0, 0, 450, 300) self.Farp_posion.show() def show_update(self): self.FUpdate = frm_githubUpdate(version) self.FUpdate.resize(480, 280) self.FUpdate.show() def show_settings(self): self.FSettings.show() def show_windows_update(self): self.FWinUpdate = frm_update_attack() self.FWinUpdate.setGeometry(QRect(100, 100, 450, 300)) self.FWinUpdate.show() def show_dhcpDOS(self): self.Fstar = frm_dhcp_main() self.Fstar.setGeometry(QRect(100, 100, 450, 200)) self.Fstar.show() def showProbe(self): self.Fprobe = frm_PMonitor() self.Fprobe.setGeometry(QRect(100, 100, 400, 400)) self.Fprobe.show() def formDauth(self): self.Fdeauth = frm_wifideauth() self.Fdeauth.setGeometry(QRect(100, 100, 200, 200)) self.Fdeauth.show() def form_mac(self): self.Fmac = frm_mac_generator() self.Fmac.setGeometry(QRect(100, 100, 300, 100)) self.Fmac.show() def show_dns_spoof(self): self.Fdns = frm_DnsSpoof() self.Fdns.setGeometry(QRect(100, 100, 450, 300)) self.Fdns.show() def show_PhishingManager(self): self.FPhishingManager = self.FormPopup.Ftemplates self.FPhishingManager.txt_redirect.setText("0.0.0.0") self.FPhishingManager.show() def credentials(self): self.Fcredentials = frm_get_credentials() self.Fcredentials.setWindowTitle("Phishing Logger") self.Fcredentials.show() def logsnetcreds(self): self.FnetCreds = frm_NetCredsLogger() self.FnetCreds.setWindowTitle("NetCreds Logger") self.FnetCreds.show() def logdns2proxy(self): self.Fdns2proxy = frm_dns2proxy() self.Fdns2proxy.setWindowTitle("Dns2proxy Logger") self.Fdns2proxy.show() def checkPlugins(self): if literal_eval(self.FSettings.xmlSettings("sslstrip_plugin", "status", None, False)): self.PopUpPlugins.check_sslstrip.setChecked(True) self.PopUpPlugins.set_sslStripRule() if literal_eval(self.FSettings.xmlSettings("netcreds_plugin", "status", None, False)): self.PopUpPlugins.check_netcreds.setChecked(True) if literal_eval(self.FSettings.xmlSettings("dns2proxy_plugin", "status", None, False)): self.PopUpPlugins.check_dns2proy.setChecked(True) self.PopUpPlugins.set_Dns2proxyRule() def Started(self, bool): if bool: self.StatusDhcp.setText("[ON]") self.StatusDhcp.setStyleSheet("QLabel { color : green; }") else: self.StatusDhcp.setText("[OFF]") self.StatusDhcp.setStyleSheet("QLabel { color : red; }") def StatusDHCPRequests(self, key): print ("Connected::[{}] hostname::[{}]".format(key, self.APclients[key]["device"])) 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()))) def GetHostapdStatus(self, data): if self.APclients != {}: if data in self.APclients.keys(): print ("Disconnected::[{}] hostname::[{}]".format(data, self.APclients[data]["device"])) for row in xrange(0, self.TabInfoAP.rowCount()): if self.TabInfoAP.item(row, 1) != None: if self.TabInfoAP.item(row, 1).text() == data: self.TabInfoAP.removeRow(row) if data in self.APclients.keys(): del self.APclients[data] for mac_tables in self.APclients.keys(): self.APclients[mac_tables]["in_tables"] = False self.THeaders = {"ip-address": [], "device": [], "mac-address": []} self.connectedCount.setText(str(len(self.APclients.keys()))) def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText([self.get_interfaces[x] for x in self.get_interfaces.keys() if x == "gateway"][0]) except: pass self.EditApName.setText(self.FSettings.xmlSettings("AP", "name", None, False)) self.EditChannel.setText(self.FSettings.xmlSettings("channel", "mchannel", None, False)) self.ConfigTwin["PortRedirect"] = self.FSettings.redirectport.text() for i, j in enumerate(self.get_interfaces["all"]): if search("wlan", j): self.selectCard.addItem(self.get_interfaces["all"][i]) driftnet = popen("which driftnet").read().split("\n") ettercap = popen("which ettercap").read().split("\n") dhcpd = popen("which dhcpd").read().split("\n") dnsmasq = popen("which dnsmasq").read().split("\n") hostapd = popen("which hostapd").read().split("\n") lista = ["/usr/sbin/airbase-ng", ettercap[0], driftnet[0], dhcpd[0], dnsmasq[0], hostapd[0]] for i in lista: self.ConfigTwin["ProgCheck"].append(path.isfile(i)) 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.") def refrash_interface(self): self.selectCard.clear() n = Refactor.get_interfaces()["all"] for i, j in enumerate(n): if search("wlan", j): self.selectCard.addItem(n[i]) 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 def delete_logger(self): content = Refactor.exportHtml() if listdir("Logs") != "": resp = QMessageBox.question( self, "About Delete Logger", "do you want to delete Logs?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No, ) if resp == QMessageBox.Yes: system("rm Logs/Caplog/*.cap") for keyFile in content["Files"]: with open(keyFile, "w") as f: f.write(""), f.close() def start_etter(self): if self.ConfigTwin["ProgCheck"][1]: if search(str(self.ConfigTwin["AP_iface"]), str(popen("ifconfig").read())): Thread_Ettercap = ProcessThread( [ "sudo", "xterm", "-geometry", "73x25-1+50", "-T", "ettercap", "-s", "-sb", "-si", "+sk", "-sl", "5000", "-e", "ettercap", "-p", "-u", "-T", "-q", "-w", "Logs/passwords", "-i", self.ConfigTwin["AP_iface"], ] ) Thread_Ettercap.setName("Tool::Ettercap") self.Apthreads["RougeAP"].append(Thread_Ettercap) Thread_Ettercap.start() return QMessageBox.information(self, "ettercap", "ettercap not found.") def start_dift(self): if self.ConfigTwin["ProgCheck"][2]: if search(str(self.ConfigTwin["AP_iface"]), str(popen("ifconfig").read())): Thread_driftnet = ProcessThread( [ "sudo", "xterm", "-geometry", "75x15+1+200", "-T", "DriftNet", "-e", "driftnet", "-i", self.ConfigTwin["AP_iface"], ] ) Thread_driftnet.setName("Tool::Driftnet") self.Apthreads["RougeAP"].append(Thread_driftnet) Thread_driftnet.start() return QMessageBox.information(self, "driftnet", "driftnet not found.") 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() def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self, "Error interface", "Network interface not supported :(") if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self, "Error Gateway", "gateway not found") if not self.ConfigTwin["ProgCheck"][5]: return QMessageBox.information(self, "Error Hostapd", "hostapd not installed") dhcp_select = self.FSettings.xmlSettings("dhcp", "dhcp_server", None, False) if dhcp_select == "iscdhcpserver": if not self.ConfigTwin["ProgCheck"][3]: return QMessageBox.warning(self, "Error dhcp", "isc-dhcp-server not installed") elif dhcp_select == "dnsmasq": if not self.ConfigTwin["ProgCheck"][4]: return QMessageBox.information(self, "Error dhcp", "dnsmasq not installed") if str(Refactor.get_interfaces()["activated"]).startswith("wlan"): return QMessageBox.information( self, "Error network card", "You are connected with interface wireless, try again with local connection" ) self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings("accesspoint", "actived", None, False) if self.APactived == "airbase-ng": self.ConfigTwin["interface"] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings("interface", "monitor_mode", self.ConfigTwin["interface"], False) # airbase thread Thread_airbase = ProcessThread( [ "airbase-ng", "-c", str(self.EditChannel.text()), "-e", self.EditApName.text(), "-F", "Logs/Caplog/" + asctime(), self.ConfigTwin["interface"], ] ) Thread_airbase.name = "Airbase-ng" self.Apthreads["RougeAP"].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin["AP_iface"] = [x for x in Refactor.get_interfaces()["all"] if search("at", x)][0] self.FSettings.xmlSettings("netcreds", "interface", self.ConfigTwin["AP_iface"], False) break self.CoreSettings() elif self.APactived == "hostapd": self.FSettings.xmlSettings("netcreds", "interface", str(self.selectCard.currentText()), False) self.ConfigTwin["AP_iface"] = str(self.selectCard.currentText()) try: check_output(["nmcli", "radio", "wifi", "off"]) except CalledProcessError: try: check_output(["nmcli", "nm", "wifi", "off"]) except CalledProcessError as e: return QMessageBox.warning(self, "Error nmcli", e) call(["rfkill", "unblock", "wlan"]) self.CoreSettings() ignore = ("interface=", "ssid=", "channel=") with open("Settings/hostapd.conf", "w") as apconf: for i in self.SettingsAP["hostapd"]: apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split("\n"): if not config.startswith("#") and len(config) > 0: if not config.startswith(ignore): apconf.write(config + "\n") apconf.close() self.Thread_hostapd = ProcessHostapd(["hostapd", "-d", "Settings/hostapd.conf"]) self.Thread_hostapd.setObjectName("hostapd") self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads["RougeAP"].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings("dhcp", "dhcp_server", None, False) if selected_dhcp == "iscdhcpserver": Thread_dhcp = ThRunDhcp( [ "sudo", "dhcpd", "-d", "-f", "-lf", "Settings/dhcp/dhcpd.leases", "-cf", "/etc/dhcp/dhcpd.conf", self.ConfigTwin["AP_iface"], ] ) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName("DHCP") self.Apthreads["RougeAP"].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else: return QMessageBox.information(self, "DHCP", selected_dhcp + " not found.") self.Started(True) self.FSettings.xmlSettings("statusAP", "value", "True", False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen("iptables -t nat -A PREROUTING -p udp -j DNAT --to {}".format(str(self.EditGateway.text()))) self.FSettings.xmlSettings("sslstrip_plugin", "status", "False", False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules("sslstrip") # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.ConfigTwin["PortRedirect"]) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads["RougeAP"].append(Thread_sslstrip) Thread_sslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread( [ "python", "Plugins/net-creds/net-creds.py", "-i", self.FSettings.xmlSettings("netcreds", "interface", None, False), ] ) Thread_netcreds.setName("Net-Creds") self.Apthreads["RougeAP"].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(["python", "Plugins/dns2proxy/dns2proxy.py"]) Thread_dns2proxy.setName("Dns2Proxy") self.Apthreads["RougeAP"].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search("--append FORWARD --in-interface", rules): popen(rules.replace("$$", self.ConfigTwin["AP_iface"])) elif search("--append POSTROUTING --out-interface", rules): popen(rules.replace("$$", str(Refactor.get_interfaces()["activated"]))) else: popen(rules) def create_sys_tray(self): self.sysTray = QSystemTrayIcon(self) self.sysTray.setIcon(QIcon("rsc/icon.ico")) self.sysTray.setVisible(True) self.connect(self.sysTray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.on_sys_tray_activated) self.sysTrayMenu = QMenu(self) self.sysTrayMenu.addAction("FOO") def on_sys_tray_activated(self, reason): if reason == 3: self.showNormal() elif reason == 2: self.showMinimized() def about(self): self.Fabout = frmAbout(author, emails, version, update, license, desc) self.Fabout.show() def issue(self): url = QUrl("https://github.com/P0cL4bs/WiFi-Pumpkin/issues/new") if not QDesktopServices.openUrl(url): QMessageBox.warning(self, "Open Url", "Could not open url")
def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface','Network interface not supported :(') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd not installed') dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select == 'iscdhcpserver': if not self.ConfigTwin['ProgCheck'][3]: return QMessageBox.warning(self,'Error dhcp','isc-dhcp-server not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq not installed') if str(Refactor.get_interfaces()['activated']).startswith('wlan'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings('accesspoint','actived',None,False) if self.APactived == 'airbase-ng': self.ConfigTwin['interface'] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode',self.ConfigTwin['interface'],False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/'+asctime(),self.ConfigTwin['interface']]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin['AP_iface'] = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.FSettings.xmlSettings('netcreds', 'interface',self.ConfigTwin['AP_iface'],False) break self.CoreSettings() elif self.APactived == 'hostapd': self.FSettings.xmlSettings('netcreds','interface', str(self.selectCard.currentText()),False) self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) try: check_output(['nmcli','radio','wifi',"off"]) except CalledProcessError: try: check_output(['nmcli','nm','wifi',"off"]) except CalledProcessError as e: return QMessageBox.warning(self,'Error nmcli',e) call(['rfkill', 'unblock' ,'wlan']) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','Settings/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else:return QMessageBox.information(self,'DHCP',selected_dhcp + ' not found.') self.Started(True) self.FSettings.xmlSettings('statusAP','value','True',False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) self.FSettings.xmlSettings('sslstrip_plugin','status','False',False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules('sslstrip') # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.ConfigTwin['PortRedirect']) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(Thread_sslstrip) Thread_sslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', self.FSettings.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules)
class SubMain(QWidget): def __init__(self, parent = None): super(SubMain, self).__init__(parent) #self.create_sys_tray() self.Main = QVBoxLayout() self.Apthreads = {'RougeAP': []} self.APclients = {} self.ConfigTwin = { 'ProgCheck':[],'AP_iface': None, 'PortRedirect': None, 'interface':'None'} self.THeaders = {'ip-address':[], 'device':[], 'mac-address':[]} self.FSettings = frm_Settings() self.PopUpPlugins = PopUpPlugins(self.FSettings) self.setGeometry(0, 0, 300, 400) self.checkPlugins() self.intGUI() def intGUI(self): self.myQMenuBar = QMenuBar(self) self.myQMenuBar.setFixedWidth(400) self.StatusBar = QStatusBar() self.StatusBar.setFixedHeight(15) self.StatusBar.addWidget(QLabel("::Access|Point::")) self.StatusDhcp = QLabel("") self.connectedCount = QLabel('') self.StatusDhcp = QLabel('') self.StatusBar.addWidget(self.StatusDhcp) self.Started(False) self.StatusBar.addWidget(QLabel(" "*21)) self.StatusBar.addWidget(QLabel("::Clients::")) self.connectedCount.setText("0") self.connectedCount.setStyleSheet("QLabel { color : yellow; }") self.StatusBar.addWidget(self.connectedCount) Menu_file = self.myQMenuBar.addMenu('&File') exportAction = QAction('Export Html', self) deleteAction = QAction('Clear Logger', self) exitAction = QAction('Exit', self) exitAction.setIcon(QIcon('rsc/close-pressed.png')) deleteAction.setIcon(QIcon('rsc/delete.png')) exportAction.setIcon(QIcon('rsc/export.png')) Menu_file.addAction(exportAction) Menu_file.addAction(deleteAction) Menu_file.addAction(exitAction) exitAction.triggered.connect(exit) deleteAction.triggered.connect(self.delete_logger) exportAction.triggered.connect(self.exportHTML) Menu_View = self.myQMenuBar.addMenu('&View') phishinglog = QAction('Monitor Phishing', self) netcredslog = QAction('Monitor NetCreds', self) dns2proxylog = QAction('Monitor Dns2proxy', self) #connect phishinglog.triggered.connect(self.credentials) netcredslog.triggered.connect(self.logsnetcreds) dns2proxylog.triggered.connect(self.logdns2proxy) #icons phishinglog.setIcon(QIcon('rsc/password.png')) netcredslog.setIcon(QIcon('rsc/logger.png')) dns2proxylog.setIcon(QIcon('rsc/proxy.png')) Menu_View.addAction(phishinglog) Menu_View.addAction(netcredslog) Menu_View.addAction(dns2proxylog) #tools Menu Menu_tools = self.myQMenuBar.addMenu('&Tools') ettercap = QAction('Active Ettercap', self) btn_drift = QAction('Active DriftNet', self) btn_drift.setShortcut('Ctrl+Y') ettercap.setShortcut('Ctrl+E') ettercap.triggered.connect(self.start_etter) btn_drift.triggered.connect(self.start_dift) # icons tools ettercap.setIcon(QIcon('rsc/ettercap.png')) btn_drift.setIcon(QIcon('rsc/capture.png')) Menu_tools.addAction(ettercap) Menu_tools.addAction(btn_drift) #menu module Menu_module = self.myQMenuBar.addMenu('&Modules') btn_deauth = QAction('Deauth Attack', self) btn_probe = QAction('Probe Request',self) btn_mac = QAction('Mac Changer', self) btn_dhcpStar = QAction('DHCP S. Attack',self) btn_winup = QAction('Windows Update',self) btn_arp = QAction('Arp Posion Attack',self) btn_dns = QAction('Dns Spoof Attack',self) btn_phishing = QAction('Phishing Manager',self) action_settings = QAction('Settings',self) # Shortcut modules btn_deauth.setShortcut('Ctrl+W') btn_probe.setShortcut('Ctrl+K') btn_mac.setShortcut('Ctrl+M') btn_dhcpStar.setShortcut('Ctrl+H') btn_winup.setShortcut('Ctrl+N') btn_dns.setShortcut('ctrl+D') btn_arp.setShortcut('ctrl+Q') btn_phishing.setShortcut('ctrl+Z') action_settings.setShortcut('Ctrl+X') #connect buttons btn_probe.triggered.connect(self.showProbe) btn_deauth.triggered.connect(self.formDauth) btn_mac.triggered.connect(self.form_mac) btn_dhcpStar.triggered.connect(self.show_dhcpDOS) btn_winup.triggered.connect(self.show_windows_update) btn_arp.triggered.connect(self.show_arp_posion) btn_dns.triggered.connect(self.show_dns_spoof) btn_phishing.triggered.connect(self.show_PhishingManager) action_settings.triggered.connect(self.show_settings) #icons Modules btn_arp.setIcon(QIcon('rsc/arp_.png')) btn_winup.setIcon(QIcon('rsc/arp.png')) btn_dhcpStar.setIcon(QIcon('rsc/dhcp.png')) btn_mac.setIcon(QIcon('rsc/mac.png')) btn_probe.setIcon(QIcon('rsc/probe.png')) btn_deauth.setIcon(QIcon('rsc/deauth.png')) btn_dns.setIcon(QIcon('rsc/dns_spoof.png')) btn_phishing.setIcon(QIcon('rsc/page.png')) action_settings.setIcon(QIcon('rsc/setting.png')) # add modules menu Menu_module.addAction(btn_deauth) Menu_module.addAction(btn_probe) Menu_module.addAction(btn_mac) Menu_module.addAction(btn_dhcpStar) Menu_module.addAction(btn_winup) Menu_module.addAction(btn_arp) Menu_module.addAction(btn_dns) Menu_module.addAction(btn_phishing) Menu_module.addAction(action_settings) #menu extra Menu_extra= self.myQMenuBar.addMenu('&Help') Menu_update = QAction('Update',self) Menu_about = QAction('About',self) Menu_issue = QAction('Submit issue',self) Menu_about.setIcon(QIcon('rsc/about.png')) Menu_issue.setIcon(QIcon('rsc/report.png')) Menu_update.setIcon(QIcon('rsc/update.png')) Menu_about.triggered.connect(self.about) Menu_issue.triggered.connect(self.issue) Menu_update.triggered.connect(self.show_update) Menu_extra.addAction(Menu_issue) Menu_extra.addAction(Menu_update) Menu_extra.addAction(Menu_about) self.EditGateway = QLineEdit(self) self.EditApName = QLineEdit(self) self.EditChannel = QLineEdit(self) self.selectCard = QComboBox(self) self.EditGateway.setFixedWidth(120) self.EditApName.setFixedWidth(120) self.EditChannel.setFixedWidth(120) # table information AP connected self.TabInfoAP = QTableWidget(5,3) self.TabInfoAP.setRowCount(100) self.TabInfoAP.setFixedHeight(150) self.TabInfoAP.setSelectionBehavior(QAbstractItemView.SelectRows) self.TabInfoAP.setEditTriggers(QAbstractItemView.NoEditTriggers) self.TabInfoAP.resizeColumnsToContents() self.TabInfoAP.resizeRowsToContents() self.TabInfoAP.horizontalHeader().resizeSection(0,90) self.TabInfoAP.horizontalHeader().resizeSection(1,120) self.TabInfoAP.horizontalHeader().resizeSection(2,100) self.TabInfoAP.verticalHeader().setVisible(False) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) #edits self.mConfigure() self.FormGroup1 = QFormLayout() self.FormGroup2 = QFormLayout() self.FormGroup3 = QFormLayout() # get logo vbox = QVBoxLayout() vbox.setMargin(5) vbox.addStretch(20) self.FormGroup1.addRow(vbox) self.logo = QPixmap(getcwd() + '/rsc/logo.png') #self.logo. self.imagem = QLabel(self) self.imagem.setPixmap(self.logo) self.FormGroup1.addRow(self.imagem) #popup settings self.btnPlugins = QToolButton(self) self.btnPlugins.setFixedHeight(25) self.btnPlugins.setIcon(QIcon('rsc/plugins.png')) self.btnPlugins.setText('[::Plugins::]') self.btnPlugins.setPopupMode(QToolButton.MenuButtonPopup) self.btnPlugins.setMenu(QMenu(self.btnPlugins)) action = QWidgetAction(self.btnPlugins) action.setDefaultWidget(self.PopUpPlugins) self.btnPlugins.menu().addAction(action) self.btnHttpServer = QToolButton(self) self.btnHttpServer.setFixedHeight(25) self.btnHttpServer.setIcon(QIcon('rsc/phishing.png')) self.FormPopup = PopUpServer(self.FSettings) self.btnHttpServer.setPopupMode(QToolButton.MenuButtonPopup) self.btnHttpServer.setMenu(QMenu(self.btnHttpServer)) action = QWidgetAction(self.btnHttpServer) action.setDefaultWidget(self.FormPopup) self.btnHttpServer.menu().addAction(action) self.GroupAP = QGroupBox() self.GroupAP.setTitle('Access Point::') self.FormGroup3.addRow('Gateway:', self.EditGateway) self.FormGroup3.addRow('AP Name:', self.EditApName) self.FormGroup3.addRow('Channel:', self.EditChannel) self.GroupAP.setLayout(self.FormGroup3) # grid network adapter fix self.btrn_refresh = QPushButton('Refresh') self.btrn_refresh.setIcon(QIcon('rsc/refresh.png')) self.btrn_refresh.clicked.connect(self.refrash_interface) self.layout = QFormLayout() self.GroupAdapter = QGroupBox() self.GroupAdapter.setFixedWidth(120) self.GroupAdapter.setTitle('Network Adapter::') self.layout.addRow(self.selectCard) self.layout.addRow(self.btrn_refresh) self.layout.addRow(self.btnPlugins,self.btnHttpServer) self.GroupAdapter.setLayout(self.layout) self.btn_start_attack = QPushButton('Start Access Point', self) self.btn_start_attack.setIcon(QIcon('rsc/start.png')) self.btn_cancelar = QPushButton('Stop Access Point', self) self.btn_cancelar.setIcon(QIcon('rsc/Stop.png')) self.btn_cancelar.clicked.connect(self.kill) self.btn_start_attack.clicked.connect(self.StartApFake) hBox = QHBoxLayout() hBox.addWidget(self.btn_start_attack) hBox.addWidget(self.btn_cancelar) self.slipt = QHBoxLayout() self.slipt.addWidget(self.GroupAP) self.slipt.addWidget(self.GroupAdapter) self.FormGroup2.addRow(hBox) self.FormGroup2.addRow(self.TabInfoAP) self.FormGroup2.addRow(self.StatusBar) self.Main.addLayout(self.FormGroup1) self.Main.addLayout(self.slipt) self.Main.addLayout(self.FormGroup2) self.setLayout(self.Main) def show_arp_posion(self): self.Farp_posion = frm_Arp_Poison() self.Farp_posion.setGeometry(0, 0, 450, 300) self.Farp_posion.show() def show_update(self): self.FUpdate = frm_githubUpdate(version) self.FUpdate.resize(480, 280) self.FUpdate.show() def show_settings(self): self.FSettings.show() def show_windows_update(self): self.FWinUpdate = frm_update_attack() self.FWinUpdate.setGeometry(QRect(100, 100, 450, 300)) self.FWinUpdate.show() def show_dhcpDOS(self): self.Fstar = frm_dhcp_main() self.Fstar.setGeometry(QRect(100, 100, 450, 200)) self.Fstar.show() def showProbe(self): self.Fprobe = frm_PMonitor() self.Fprobe.setGeometry(QRect(100, 100, 400, 400)) self.Fprobe.show() def formDauth(self): self.Fdeauth = frm_wifideauth() self.Fdeauth.setGeometry(QRect(100, 100, 200, 200)) self.Fdeauth.show() def form_mac(self): self.Fmac = frm_mac_generator() self.Fmac.setGeometry(QRect(100, 100, 300, 100)) self.Fmac.show() def show_dns_spoof(self): self.Fdns = frm_DnsSpoof() self.Fdns.setGeometry(QRect(100, 100, 450, 300)) self.Fdns.show() def show_PhishingManager(self): self.FPhishingManager = self.FormPopup.Ftemplates self.FPhishingManager.txt_redirect.setText('0.0.0.0') self.FPhishingManager.show() def credentials(self): self.Fcredentials = frm_get_credentials() self.Fcredentials.setWindowTitle('Phishing Logger') self.Fcredentials.show() def logsnetcreds(self): self.FnetCreds = frm_NetCredsLogger() self.FnetCreds.setWindowTitle('NetCreds Logger') self.FnetCreds.show() def logdns2proxy(self): self.Fdns2proxy = frm_dns2proxy() self.Fdns2proxy.setWindowTitle('Dns2proxy Logger') self.Fdns2proxy.show() def checkPlugins(self): if literal_eval(self.FSettings.xmlSettings('sslstrip_plugin','status',None,False)): self.PopUpPlugins.check_sslstrip.setChecked(True) self.PopUpPlugins.set_sslStripRule() if literal_eval(self.FSettings.xmlSettings('netcreds_plugin','status',None,False)): self.PopUpPlugins.check_netcreds.setChecked(True) if literal_eval(self.FSettings.xmlSettings('dns2proxy_plugin','status',None,False)): self.PopUpPlugins.check_dns2proy.setChecked(True) self.PopUpPlugins.set_Dns2proxyRule() def Started(self,bool): if bool: self.StatusDhcp.setText("[ON]") self.StatusDhcp.setStyleSheet("QLabel { color : green; }") else: self.StatusDhcp.setText("[OFF]") self.StatusDhcp.setStyleSheet("QLabel { color : red; }") def StatusDHCPRequests(self,key): print('Connected::[{}] hostname::[{}]'.format(key,self.APclients[key]['device'])) 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()))) def GetHostapdStatus(self,data): if self.APclients != {}: if data in self.APclients.keys(): print('Disconnected::[{}] hostname::[{}]'.format(data,self.APclients[data]['device'])) for row in xrange(0,self.TabInfoAP.rowCount()): if self.TabInfoAP.item(row,1) != None: if self.TabInfoAP.item(row,1).text() == data: self.TabInfoAP.removeRow(row) if data in self.APclients.keys(): del self.APclients[data] for mac_tables in self.APclients.keys():self.APclients[mac_tables]['in_tables'] = False self.THeaders = {'ip-address':[], 'device':[], 'mac-address':[]} self.connectedCount.setText(str(len(self.APclients.keys()))) def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText( [self.get_interfaces[x] for x in self.get_interfaces.keys() if x == 'gateway'][0]) except:pass self.EditApName.setText(self.FSettings.xmlSettings('AP', 'name',None,False)) self.EditChannel.setText(self.FSettings.xmlSettings('channel', 'mchannel',None,False)) self.ConfigTwin['PortRedirect'] = self.FSettings.redirectport.text() for i,j in enumerate(self.get_interfaces['all']): if search('wlan', j):self.selectCard.addItem(self.get_interfaces['all'][i]) driftnet = popen('which driftnet').read().split('\n') ettercap = popen('which ettercap').read().split('\n') dhcpd = popen('which dhcpd').read().split("\n") dnsmasq = popen('which dnsmasq').read().split("\n") hostapd = popen('which hostapd').read().split("\n") lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0],dhcpd[0],dnsmasq[0],hostapd[0]] for i in lista:self.ConfigTwin['ProgCheck'].append(path.isfile(i)) 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.') def refrash_interface(self): self.selectCard.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('wlan', j): self.selectCard.addItem(n[i]) 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 def delete_logger(self): content = Refactor.exportHtml() if listdir('Logs')!= '': resp = QMessageBox.question(self, 'About Delete Logger', 'do you want to delete Logs?',QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if resp == QMessageBox.Yes: system('rm Logs/Caplog/*.cap') for keyFile in content['Files']: with open(keyFile,'w') as f: f.write(''),f.close() def start_etter(self): if self.ConfigTwin['ProgCheck'][1]: if search(str(self.ConfigTwin['AP_iface']),str(popen('ifconfig').read())): Thread_Ettercap = ProcessThread(['sudo', 'xterm', '-geometry', '73x25-1+50', '-T', 'ettercap', '-s', '-sb', '-si', '+sk', '-sl', '5000', '-e', 'ettercap', '-p', '-u', '-T', '-q', '-w', 'Logs/passwords', '-i', self.ConfigTwin['AP_iface']]) Thread_Ettercap.setName('Tool::Ettercap') self.Apthreads['RougeAP'].append(Thread_Ettercap) Thread_Ettercap.start() return QMessageBox.information(self,'ettercap','ettercap not found.') def start_dift(self): if self.ConfigTwin['ProgCheck'][2]: if search(str(self.ConfigTwin['AP_iface']),str(popen('ifconfig').read())): Thread_driftnet = ProcessThread(['sudo', 'xterm', '-geometry', '75x15+1+200', '-T', 'DriftNet', '-e', 'driftnet', '-i', self.ConfigTwin['AP_iface']]) Thread_driftnet.setName('Tool::Driftnet') self.Apthreads['RougeAP'].append(Thread_driftnet) Thread_driftnet.start() return QMessageBox.information(self,'driftnet','driftnet not found.') 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() def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface','Network interface not supported :(') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd not installed') dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select == 'iscdhcpserver': if not self.ConfigTwin['ProgCheck'][3]: return QMessageBox.warning(self,'Error dhcp','isc-dhcp-server not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq not installed') if str(Refactor.get_interfaces()['activated']).startswith('wlan'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings('accesspoint','actived',None,False) if self.APactived == 'airbase-ng': self.ConfigTwin['interface'] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode',self.ConfigTwin['interface'],False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/'+asctime(),self.ConfigTwin['interface']]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin['AP_iface'] = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.FSettings.xmlSettings('netcreds', 'interface',self.ConfigTwin['AP_iface'],False) break self.CoreSettings() elif self.APactived == 'hostapd': self.FSettings.xmlSettings('netcreds','interface', str(self.selectCard.currentText()),False) self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) try: check_output(['nmcli','radio','wifi',"off"]) except CalledProcessError: try: check_output(['nmcli','nm','wifi',"off"]) except CalledProcessError as e: return QMessageBox.warning(self,'Error nmcli',e) call(['rfkill', 'unblock' ,'wlan']) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','Settings/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else:return QMessageBox.information(self,'DHCP',selected_dhcp + ' not found.') self.Started(True) self.FSettings.xmlSettings('statusAP','value','True',False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) self.FSettings.xmlSettings('sslstrip_plugin','status','False',False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules('sslstrip') # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.ConfigTwin['PortRedirect']) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(Thread_sslstrip) Thread_sslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', self.FSettings.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules) def create_sys_tray(self): self.sysTray = QSystemTrayIcon(self) self.sysTray.setIcon(QIcon('rsc/icon.ico')) self.sysTray.setVisible(True) self.connect(self.sysTray, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self.on_sys_tray_activated) self.sysTrayMenu = QMenu(self) self.sysTrayMenu.addAction('FOO') def on_sys_tray_activated(self, reason): if reason == 3:self.showNormal() elif reason == 2:self.showMinimized() def about(self): self.Fabout = frmAbout(author,emails, version,update,license,desc) self.Fabout.show() def issue(self): url = QUrl('https://github.com/P0cL4bs/WiFi-Pumpkin/issues/new') if not QDesktopServices.openUrl(url): QMessageBox.warning(self, 'Open Url', 'Could not open url')
def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface ','Network interface is not found') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway is not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd is not installed') dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select == 'iscdhcpserver': if not self.ConfigTwin['ProgCheck'][3]: return QMessageBox.warning(self,'Error dhcp','isc-dhcp-server is not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq is not installed') if str(Refactor.get_interfaces()['activated']).startswith('wl'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings('accesspoint','actived',None,False) if self.APactived == 'airbase-ng': self.ConfigTwin['interface'] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode',self.ConfigTwin['interface'],False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/'+asctime(),self.ConfigTwin['interface']]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin['AP_iface'] = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.FSettings.xmlSettings('netcreds', 'interface',self.ConfigTwin['AP_iface'],False) break self.CoreSettings() elif self.APactived == 'hostapd': self.FSettings.xmlSettings('netcreds','interface', str(self.selectCard.currentText()),False) self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) try: check_output(['nmcli','radio','wifi',"off"]) except CalledProcessError: try: check_output(['nmcli','nm','wifi',"off"]) except CalledProcessError as e: return QMessageBox.warning(self,'Error nmcli',e) call(['rfkill', 'unblock' ,'wifi']) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','Settings/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else:return QMessageBox.information(self,'DHCP',selected_dhcp + ' not found.') self.Started(True) self.ProxyPluginsTAB.GroupSettings.setEnabled(False) self.FSettings.xmlSettings('statusAP','value','True',False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) self.FSettings.xmlSettings('sslstrip_plugin','status','False',False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules('sslstrip') if self.PopUpPlugins.check_sslstrip.isChecked() or not self.PopUpPlugins.check_dns2proy.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) # load ProxyPLugins self.plugin_classes = Plugin.PluginProxy.__subclasses__() self.plugins = {} for p in self.plugin_classes: self.plugins[p._name] = p() # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked() and not self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sslstrip(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() elif not self.PopUpPlugins.check_sslstrip.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() elif self.PopUpPlugins.check_sergioProxy.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', self.FSettings.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules)
class SubMain(QWidget): ''' load main window class''' def __init__(self, parent = None): super(SubMain, self).__init__(parent) #self.create_sys_tray() self.MainControl = QVBoxLayout(self) self.TabControl = QTabWidget(self) self.Tab_Default = QWidget(self) self.Tab_Injector = QWidget(self) self.Tab_Settings = QWidget(self) self.Tab_ApMonitor = QWidget(self) #self.TabControl.setTabPosition(QTabWidget.w) self.TabControl.addTab(self.Tab_Default,'Home') self.TabControl.addTab(self.Tab_Injector,'Pump-Proxy') self.TabControl.addTab(self.Tab_Settings,'Pump-Settings') self.TabControl.addTab(self.Tab_ApMonitor,'Pump-Monitor') self.ContentTabHome = QVBoxLayout(self.Tab_Default) self.ContentTabInject = QVBoxLayout(self.Tab_Injector) self.ContentTabsettings= QVBoxLayout(self.Tab_Settings) self.ContentTabMonitor = QVBoxLayout(self.Tab_ApMonitor) self.Apthreads = {'RougeAP': []} self.APclients = {} self.ConfigTwin = { 'ProgCheck':[],'AP_iface': None, 'PortRedirect': None, 'interface':'None'} self.THeaders = {'ip-address':[], 'device':[], 'mac-address':[]} self.FSettings = frm_Settings() self.PopUpPlugins = PopUpPlugins(self.FSettings) self.checkPlugins() self.intGUI() def loadBanner(self): vbox = QVBoxLayout() vbox.setMargin(4) vbox.addStretch(2) self.FormBanner = QFormLayout() self.FormBanner.addRow(vbox) self.logo = QPixmap(getcwd() + '/Icons/logo.png') self.imagem = QLabel(self) self.imagem.setPixmap(self.logo) self.FormBanner.addRow(self.imagem) def InjectorTABContent(self): self.ProxyPluginsTAB = PumpkinProxy(self.PopUpPlugins) self.ProxyPluginsTAB.sendError.connect(self.GetErrorInjector) self.ContentTabInject.addLayout(self.ProxyPluginsTAB) def GetErrorInjector(self,data): QMessageBox.warning(self,'Error Module::Proxy',data) def GetmessageSave(self,data): QMessageBox.information(self,'Settings DHCP',data) def ApMonitorTabContent(self): self.PumpMonitorTAB = PumpkinMonitor() self.ContentTabMonitor.addLayout(self.PumpMonitorTAB) def SettingsTABContent(self): self.PumpSettingsTAB = PumpkinSettings() self.PumpSettingsTAB.sendMensage.connect(self.GetmessageSave) self.ContentTabsettings.addLayout(self.PumpSettingsTAB) def DefaultTABContent(self): self.StatusBar = QStatusBar() self.StatusBar.setFixedHeight(15) self.StatusBar.addWidget(QLabel("::Access|Point::")) self.StatusDhcp = QLabel("") self.connectedCount = QLabel('') self.StatusDhcp = QLabel('') self.StatusBar.addWidget(self.StatusDhcp) self.Started(False) self.StatusBar.addWidget(QLabel(" "*21)) self.StatusBar.addWidget(QLabel("::Clients::")) self.connectedCount.setText("0") self.connectedCount.setStyleSheet("QLabel { color : yellow; }") self.StatusBar.addWidget(self.connectedCount) self.EditGateway = QLineEdit(self) self.EditApName = QLineEdit(self) self.EditChannel = QLineEdit(self) self.selectCard = QComboBox(self) # table information AP connected self.TabInfoAP = QTableWidget(5,3) self.TabInfoAP.setRowCount(50) self.TabInfoAP.setFixedHeight(180) self.TabInfoAP.resizeRowsToContents() self.TabInfoAP.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.TabInfoAP.horizontalHeader().setStretchLastSection(True) self.TabInfoAP.setSelectionBehavior(QAbstractItemView.SelectRows) self.TabInfoAP.setEditTriggers(QAbstractItemView.NoEditTriggers) self.TabInfoAP.verticalHeader().setVisible(False) self.TabInfoAP.setHorizontalHeaderLabels(self.THeaders.keys()) #edits self.mConfigure() self.FormGroup2 = QFormLayout() self.FormGroup3 = QFormLayout() #popup settings self.btnPlugins = QToolButton(self) self.btnPlugins.setFixedHeight(25) self.btnPlugins.setIcon(QIcon('Icons/plugins.png')) self.btnPlugins.setText('[::Plugins::]') self.btnPlugins.setPopupMode(QToolButton.MenuButtonPopup) self.btnPlugins.setMenu(QMenu(self.btnPlugins)) action = QWidgetAction(self.btnPlugins) action.setDefaultWidget(self.PopUpPlugins) self.btnPlugins.menu().addAction(action) self.btnHttpServer = QToolButton(self) self.btnHttpServer.setFixedHeight(25) self.btnHttpServer.setIcon(QIcon('Icons/phishing.png')) self.FormPopup = PopUpServer(self.FSettings) self.btnHttpServer.setPopupMode(QToolButton.MenuButtonPopup) self.btnHttpServer.setMenu(QMenu(self.btnHttpServer)) action = QWidgetAction(self.btnHttpServer) action.setDefaultWidget(self.FormPopup) self.btnHttpServer.menu().addAction(action) self.GroupAP = QGroupBox() self.GroupAP.setTitle('Access Point::') self.FormGroup3.addRow('Gateway:', self.EditGateway) self.FormGroup3.addRow('AP Name:', self.EditApName) self.FormGroup3.addRow('Channel:', self.EditChannel) self.GroupAP.setLayout(self.FormGroup3) # grid network adapter fix self.btrn_refresh = QPushButton('Refresh') self.btrn_refresh.setIcon(QIcon('Icons/refresh.png')) self.btrn_refresh.clicked.connect(self.refrash_interface) self.layout = QFormLayout() self.GroupAdapter = QGroupBox() self.GroupAdapter.setFixedWidth(120) self.GroupAdapter.setTitle('Network Adapter::') self.layout.addRow(self.selectCard) self.layout.addRow(self.btrn_refresh) self.layout.addRow(self.btnPlugins,self.btnHttpServer) self.GroupAdapter.setLayout(self.layout) self.btn_start_attack = QPushButton('Start Access Point', self) self.btn_start_attack.setIcon(QIcon('Icons/start.png')) self.btn_cancelar = QPushButton('Stop Access Point', self) self.btn_cancelar.setIcon(QIcon('Icons/Stop.png')) self.btn_cancelar.clicked.connect(self.kill) self.btn_start_attack.clicked.connect(self.StartApFake) hBox = QHBoxLayout() hBox.addWidget(self.btn_start_attack) hBox.addWidget(self.btn_cancelar) self.slipt = QHBoxLayout() self.slipt.addWidget(self.GroupAP) self.slipt.addWidget(self.GroupAdapter) self.FormGroup2.addRow(hBox) self.FormGroup2.addRow(self.TabInfoAP) self.FormGroup2.addRow(self.StatusBar) self.ContentTabHome.addLayout(self.slipt) self.ContentTabHome.addLayout(self.FormGroup2) def intGUI(self): self.loadBanner() self.DefaultTABContent() self.InjectorTABContent() self.SettingsTABContent() self.ApMonitorTabContent() self.myQMenuBar = QMenuBar(self) self.myQMenuBar.setFixedWidth(400) Menu_file = self.myQMenuBar.addMenu('&File') exportAction = QAction('Export Html', self) deleteAction = QAction('Clear Logger', self) exitAction = QAction('Exit', self) exitAction.setIcon(QIcon('Icons/close-pressed.png')) deleteAction.setIcon(QIcon('Icons/delete.png')) exportAction.setIcon(QIcon('Icons/export.png')) Menu_file.addAction(exportAction) Menu_file.addAction(deleteAction) Menu_file.addAction(exitAction) exitAction.triggered.connect(exit) deleteAction.triggered.connect(self.delete_logger) exportAction.triggered.connect(self.exportHTML) Menu_View = self.myQMenuBar.addMenu('&View') phishinglog = QAction('Monitor Phishing', self) netcredslog = QAction('Monitor NetCreds', self) dns2proxylog = QAction('Monitor Dns2proxy', self) #connect phishinglog.triggered.connect(self.credentials) netcredslog.triggered.connect(self.logsnetcreds) dns2proxylog.triggered.connect(self.logdns2proxy) #icons phishinglog.setIcon(QIcon('Icons/password.png')) netcredslog.setIcon(QIcon('Icons/logger.png')) dns2proxylog.setIcon(QIcon('Icons/proxy.png')) Menu_View.addAction(phishinglog) Menu_View.addAction(netcredslog) Menu_View.addAction(dns2proxylog) #tools Menu Menu_tools = self.myQMenuBar.addMenu('&Tools') ettercap = QAction('Active Ettercap', self) btn_drift = QAction('Active DriftNet', self) btn_drift.setShortcut('Ctrl+Y') ettercap.setShortcut('Ctrl+E') ettercap.triggered.connect(self.start_etter) btn_drift.triggered.connect(self.start_dift) # icons tools ettercap.setIcon(QIcon('Icons/ettercap.png')) btn_drift.setIcon(QIcon('Icons/capture.png')) Menu_tools.addAction(ettercap) Menu_tools.addAction(btn_drift) #menu module Menu_module = self.myQMenuBar.addMenu('&Modules') btn_deauth = QAction('Deauth Attack', self) btn_probe = QAction('Probe Request',self) btn_mac = QAction('Mac Changer', self) btn_dhcpStar = QAction('DHCP S. Attack',self) btn_winup = QAction('Windows Update',self) btn_arp = QAction('Arp Posion Attack',self) btn_dns = QAction('Dns Spoof Attack',self) btn_phishing = QAction('Phishing Manager',self) action_settings = QAction('Settings',self) # Shortcut modules btn_deauth.setShortcut('Ctrl+W') btn_probe.setShortcut('Ctrl+K') btn_mac.setShortcut('Ctrl+M') btn_dhcpStar.setShortcut('Ctrl+H') btn_winup.setShortcut('Ctrl+N') btn_dns.setShortcut('ctrl+D') btn_arp.setShortcut('ctrl+Q') btn_phishing.setShortcut('ctrl+Z') action_settings.setShortcut('Ctrl+X') #connect buttons btn_probe.triggered.connect(self.showProbe) btn_deauth.triggered.connect(self.formDauth) btn_mac.triggered.connect(self.form_mac) btn_dhcpStar.triggered.connect(self.show_dhcpDOS) btn_winup.triggered.connect(self.show_windows_update) btn_arp.triggered.connect(self.show_arp_posion) btn_dns.triggered.connect(self.show_dns_spoof) btn_phishing.triggered.connect(self.show_PhishingManager) action_settings.triggered.connect(self.show_settings) #icons Modules btn_arp.setIcon(QIcon('Icons/arp_.png')) btn_winup.setIcon(QIcon('Icons/arp.png')) btn_dhcpStar.setIcon(QIcon('Icons/dhcp.png')) btn_mac.setIcon(QIcon('Icons/mac.png')) btn_probe.setIcon(QIcon('Icons/probe.png')) btn_deauth.setIcon(QIcon('Icons/deauth.png')) btn_dns.setIcon(QIcon('Icons/dns_spoof.png')) btn_phishing.setIcon(QIcon('Icons/page.png')) action_settings.setIcon(QIcon('Icons/setting.png')) # add modules menu Menu_module.addAction(btn_deauth) Menu_module.addAction(btn_probe) Menu_module.addAction(btn_mac) Menu_module.addAction(btn_dhcpStar) Menu_module.addAction(btn_winup) Menu_module.addAction(btn_arp) Menu_module.addAction(btn_dns) Menu_module.addAction(btn_phishing) Menu_module.addAction(action_settings) #menu extra Menu_extra= self.myQMenuBar.addMenu('&Help') Menu_update = QAction('Update',self) Menu_about = QAction('About',self) Menu_issue = QAction('Submit issue',self) Menu_about.setIcon(QIcon('Icons/about.png')) Menu_issue.setIcon(QIcon('Icons/report.png')) Menu_update.setIcon(QIcon('Icons/update.png')) Menu_about.triggered.connect(self.about) Menu_issue.triggered.connect(self.issue) Menu_update.triggered.connect(self.show_update) Menu_extra.addAction(Menu_issue) Menu_extra.addAction(Menu_update) Menu_extra.addAction(Menu_about) self.MainControl.addLayout(self.FormBanner) self.MainControl.addWidget(self.TabControl) self.setLayout(self.MainControl) def show_arp_posion(self): self.Farp_posion = GUIModules.frm_Arp_Poison() self.Farp_posion.setGeometry(0, 0, 450, 300) self.Farp_posion.show() def show_update(self): self.FUpdate = frm_githubUpdate(version) self.FUpdate.resize(480, 280) self.FUpdate.show() def show_settings(self): self.FSettings.show() def show_windows_update(self): self.FWinUpdate = GUIModules.frm_update_attack() self.FWinUpdate.setGeometry(QRect(100, 100, 450, 300)) self.FWinUpdate.show() def show_dhcpDOS(self): self.Fstar = GUIModules.frm_dhcp_Attack() self.Fstar.setGeometry(QRect(100, 100, 450, 200)) self.Fstar.show() def showProbe(self): self.Fprobe = GUIModules.frm_PMonitor() self.Fprobe.setGeometry(QRect(100, 100, 400, 400)) self.Fprobe.show() def formDauth(self): self.Fdeauth =GUIModules.frm_deauth() self.Fdeauth.setGeometry(QRect(100, 100, 200, 200)) self.Fdeauth.show() def form_mac(self): self.Fmac = GUIModules.frm_mac_generator() self.Fmac.setGeometry(QRect(100, 100, 300, 100)) self.Fmac.show() def show_dns_spoof(self): self.Fdns = GUIModules.frm_DnsSpoof() self.Fdns.setGeometry(QRect(100, 100, 450, 300)) self.Fdns.show() def show_PhishingManager(self): self.FPhishingManager = self.FormPopup.Ftemplates self.FPhishingManager.txt_redirect.setText('0.0.0.0') self.FPhishingManager.show() def credentials(self): self.Fcredentials = GUIModules.frm_get_credentials() self.Fcredentials.setWindowTitle('Phishing Logger') self.Fcredentials.show() def logsnetcreds(self): self.FnetCreds = GUIModules.frm_NetCredsLogger() self.FnetCreds.setWindowTitle('NetCreds Logger') self.FnetCreds.show() def logdns2proxy(self): self.Fdns2proxy = GUIModules.frm_dns2proxy() self.Fdns2proxy.setWindowTitle('Dns2proxy Logger') self.Fdns2proxy.show() def checkPlugins(self): if literal_eval(self.FSettings.xmlSettings('sslstrip_plugin','status',None,False)): self.PopUpPlugins.check_sslstrip.setChecked(True) self.PopUpPlugins.set_sslStripRule() if literal_eval(self.FSettings.xmlSettings('netcreds_plugin','status',None,False)): self.PopUpPlugins.check_netcreds.setChecked(True) if literal_eval(self.FSettings.xmlSettings('dns2proxy_plugin','status',None,False)): self.PopUpPlugins.check_dns2proy.setChecked(True) self.PopUpPlugins.set_Dns2proxyRule() if literal_eval(self.FSettings.xmlSettings('sergioproxy_plugin','status',None,False)): self.PopUpPlugins.check_sergioProxy.setChecked(True) if not literal_eval(self.FSettings.xmlSettings('sslstrip_plugin','status',None,False)): self.PopUpPlugins.set_sslStripRule() def Started(self,bool): if bool: self.StatusDhcp.setText("[ON]") self.StatusDhcp.setStyleSheet("QLabel { color : green; }") else: self.StatusDhcp.setText("[OFF]") self.StatusDhcp.setStyleSheet("QLabel { color : red; }") def StatusDHCPRequests(self,mac,user_info): return self.PumpMonitorTAB.addRequests(mac,user_info,True) 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('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]]) 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()))) def GetHostapdStatus(self,data): if self.APclients != {}: if data in self.APclients.keys(): self.PumpMonitorTAB.addRequests(data,self.APclients[data],False) for row in xrange(0,self.TabInfoAP.rowCount()): if self.TabInfoAP.item(row,1) != None: if self.TabInfoAP.item(row,1).text() == data: self.TabInfoAP.removeRow(row) if data in self.APclients.keys(): del self.APclients[data] for mac_tables in self.APclients.keys():self.APclients[mac_tables]['in_tables'] = False self.THeaders = {'ip-address':[], 'device':[], 'mac-address':[]} self.connectedCount.setText(str(len(self.APclients.keys()))) def mConfigure(self): self.get_interfaces = Refactor.get_interfaces() try: self.EditGateway.setText( [self.get_interfaces[x] for x in self.get_interfaces.keys() if x == 'gateway'][0]) except:pass self.EditApName.setText(self.FSettings.xmlSettings('AP', 'name',None,False)) self.EditChannel.setText(self.FSettings.xmlSettings('channel', 'mchannel',None,False)) self.ConfigTwin['PortRedirect'] = self.FSettings.redirectport.text() for i,j in enumerate(self.get_interfaces['all']): if search('wl', j):self.selectCard.addItem(self.get_interfaces['all'][i]) driftnet = popen('which driftnet').read().split('\n') ettercap = popen('which ettercap').read().split('\n') dhcpd = popen('which dhcpd').read().split("\n") dnsmasq = popen('which dnsmasq').read().split("\n") hostapd = popen('which hostapd').read().split("\n") lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0],dhcpd[0],dnsmasq[0],hostapd[0]] for i in lista:self.ConfigTwin['ProgCheck'].append(path.isfile(i)) 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.') def refrash_interface(self): self.selectCard.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('wl', j): self.selectCard.addItem(n[i]) 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) def delete_logger(self): content = Refactor.exportHtml() if listdir('Logs')!= '': resp = QMessageBox.question(self, 'About Delete Logger', 'do you want to delete Logs?',QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if resp == QMessageBox.Yes: system('rm Logs/Caplog/*.cap') for keyFile in content['Files']: with open(keyFile,'w') as f: f.write(''),f.close() def start_etter(self): if self.ConfigTwin['ProgCheck'][1]: if search(str(self.ConfigTwin['AP_iface']),str(popen('ifconfig').read())): Thread_Ettercap = ProcessThread(['sudo', 'xterm', '-geometry', '73x25-1+50', '-T', 'ettercap', '-s', '-sb', '-si', '+sk', '-sl', '5000', '-e', 'ettercap', '-p', '-u', '-T', '-q', '-w', 'Logs/passwords', '-i', self.ConfigTwin['AP_iface']]) Thread_Ettercap.setName('Tool::Ettercap') self.Apthreads['RougeAP'].append(Thread_Ettercap) Thread_Ettercap.start() return QMessageBox.information(self,'ettercap','ettercap is not found.') def start_dift(self): if self.ConfigTwin['ProgCheck'][2]: if search(str(self.ConfigTwin['AP_iface']),str(popen('ifconfig').read())): Thread_driftnet = ProcessThread(['sudo', 'xterm', '-geometry', '75x15+1+200', '-T', 'DriftNet', '-e', 'driftnet', '-i', self.ConfigTwin['AP_iface']]) Thread_driftnet.setName('Tool::Driftnet') self.Apthreads['RougeAP'].append(Thread_driftnet) Thread_driftnet.start() return QMessageBox.information(self,'driftnet','driftnet is not found.') 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() def StartApFake(self): if len(self.selectCard.currentText()) == 0: return QMessageBox.warning(self,'Error interface ','Network interface is not found') if len(self.EditGateway.text()) == 0: return QMessageBox.warning(self,'Error Gateway','gateway is not found') if not self.ConfigTwin['ProgCheck'][5]: return QMessageBox.information(self,'Error Hostapd','hostapd is not installed') dhcp_select = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select == 'iscdhcpserver': if not self.ConfigTwin['ProgCheck'][3]: return QMessageBox.warning(self,'Error dhcp','isc-dhcp-server is not installed') elif dhcp_select == 'dnsmasq': if not self.ConfigTwin['ProgCheck'][4]: return QMessageBox.information(self,'Error dhcp','dnsmasq is not installed') if str(Refactor.get_interfaces()['activated']).startswith('wl'): return QMessageBox.information(self,'Error network card', 'You are connected with interface wireless, try again with local connection') self.btn_start_attack.setDisabled(True) self.APactived = self.FSettings.xmlSettings('accesspoint','actived',None,False) if self.APactived == 'airbase-ng': self.ConfigTwin['interface'] = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode',self.ConfigTwin['interface'],False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/'+asctime(),self.ConfigTwin['interface']]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.ConfigTwin['AP_iface'] = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.FSettings.xmlSettings('netcreds', 'interface',self.ConfigTwin['AP_iface'],False) break self.CoreSettings() elif self.APactived == 'hostapd': self.FSettings.xmlSettings('netcreds','interface', str(self.selectCard.currentText()),False) self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText()) try: check_output(['nmcli','radio','wifi',"off"]) except CalledProcessError: try: check_output(['nmcli','nm','wifi',"off"]) except CalledProcessError as e: return QMessageBox.warning(self,'Error nmcli',e) call(['rfkill', 'unblock' ,'wifi']) self.CoreSettings() ignore = ('interface=','ssid=','channel=') with open('Settings/hostapd.conf','w') as apconf: for i in self.SettingsAP['hostapd']:apconf.write(i) for config in str(self.FSettings.ListHostapd.toPlainText()).split('\n'): if not config.startswith('#') and len(config) > 0: if not config.startswith(ignore): apconf.write(config+'\n') apconf.close() self.Thread_hostapd = ProcessHostapd(['hostapd','-d','Settings/hostapd.conf']) self.Thread_hostapd.setObjectName('hostapd') self.Thread_hostapd.statusAP_connected.connect(self.GetHostapdStatus) self.Apthreads['RougeAP'].append(self.Thread_hostapd) self.Thread_hostapd.start() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','Settings/dhcp/dhcpd.leases','-cf', '/etc/dhcp/dhcpd.conf',self.ConfigTwin['AP_iface']]) Thread_dhcp.sendRequest.connect(self.GetDHCPRequests) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() ##### dnsmasq disabled # elif selected_dhcp == 'dnsmasq': # Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Core/config/dnsmasq.conf','-d']) # self.connect(Thread_dhcp ,SIGNAL('Activated ( QString ) '), self.dhcpLog) # Thread_dhcp .setObjectName('DHCP') # self.Apthreads['RougeAP'].append(Thread_dhcp) # Thread_dhcp .start() else:return QMessageBox.information(self,'DHCP',selected_dhcp + ' not found.') self.Started(True) self.ProxyPluginsTAB.GroupSettings.setEnabled(False) self.FSettings.xmlSettings('statusAP','value','True',False) if self.FSettings.check_redirect.isChecked() or not self.PopUpPlugins.check_sslstrip.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) self.FSettings.xmlSettings('sslstrip_plugin','status','False',False) self.PopUpPlugins.check_sslstrip.setChecked(False) self.PopUpPlugins.unset_Rules('sslstrip') if self.PopUpPlugins.check_sslstrip.isChecked() or not self.PopUpPlugins.check_dns2proy.isChecked(): popen('iptables -t nat -A PREROUTING -p udp -j DNAT --to {}'.format(str(self.EditGateway.text()))) # load ProxyPLugins self.plugin_classes = Plugin.PluginProxy.__subclasses__() self.plugins = {} for p in self.plugin_classes: self.plugins[p._name] = p() # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked() and not self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sslstrip(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() elif not self.PopUpPlugins.check_sslstrip.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() elif self.PopUpPlugins.check_sergioProxy.isChecked() and self.PopUpPlugins.check_sergioProxy.isChecked(): self.Threadsslstrip = Thread_sergioProxy(self.ConfigTwin['PortRedirect'], self.plugins,self.ProxyPluginsTAB._PluginsToLoader) self.Threadsslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(self.Threadsslstrip) self.Threadsslstrip.start() if self.PopUpPlugins.check_netcreds.isChecked(): Thread_netcreds = ProcessThread(['python','Plugins/net-creds/net-creds.py','-i', self.FSettings.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() if self.PopUpPlugins.check_dns2proy.isChecked(): Thread_dns2proxy = ProcessThread(['python','Plugins/dns2proxy/dns2proxy.py']) Thread_dns2proxy.setName('Dns2Proxy') self.Apthreads['RougeAP'].append(Thread_dns2proxy) Thread_dns2proxy.start() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('--append FORWARD --in-interface', rules):popen(rules.replace('$$',self.ConfigTwin['AP_iface'])) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else:popen(rules) def create_sys_tray(self): self.sysTray = QSystemTrayIcon(self) self.sysTray.setIcon(QIcon('Icons/icon.ico')) self.sysTray.setVisible(True) self.connect(self.sysTray, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self.on_sys_tray_activated) self.sysTrayMenu = QMenu(self) self.sysTrayMenu.addAction('FOO') def on_sys_tray_activated(self, reason): if reason == 3:self.showNormal() elif reason == 2:self.showMinimized() def about(self): self.Fabout = frmAbout(author,emails, version,update,license,desc) self.Fabout.show() def issue(self): url = QUrl('https://github.com/P0cL4bs/WiFi-Pumpkin/issues/new') if not QDesktopServices.openUrl(url): QMessageBox.warning(self, 'Open Url', 'Could not open url')