当前位置: 首页>>代码示例>>Python>>正文


Python Refactor.settingsNetworkManager方法代码示例

本文整理汇总了Python中Core.Utils.Refactor.settingsNetworkManager方法的典型用法代码示例。如果您正苦于以下问题:Python Refactor.settingsNetworkManager方法的具体用法?Python Refactor.settingsNetworkManager怎么用?Python Refactor.settingsNetworkManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.Utils.Refactor的用法示例。


在下文中一共展示了Refactor.settingsNetworkManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kill

# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import settingsNetworkManager [as 别名]
 def kill(self):
     if self.Apthreads['RougeAP'] == []: return
     self.ProxyPluginsTAB.GroupSettings.setEnabled(True)
     self.FSettings.Settings.set_setting('accesspoint','statusAP',False)
     if hasattr(self,'dockAreaList'):
         for dock in self.dockAreaList.keys():
             self.dockAreaList[dock].clear()
             self.dockAreaList[dock].stopProcess()
     self.PumpSettingsTAB.GroupArea.setEnabled(True)
     for thread in self.Apthreads['RougeAP']: thread.stop()
     for kill in self.SettingsAP['kill']:
         Popen(kill.split(), stdout=PIPE,shell=False,stderr=PIPE)
     Refactor.settingsNetworkManager(self.ConfigTwin['AP_iface'],Remove=True)
     set_monitor_mode(self.ConfigTwin['AP_iface']).setDisable()
     self.Started(False)
     self.progress.setValue(1)
     self.progress.change_color('')
     self.Apthreads['RougeAP'] = []
     self.APclients = {}
     lines = []
     if self.ProxyPluginsTAB.log_inject.count()>0:
         with open('Logs/AccessPoint/injectionPage.log','w') as injectionlog:
             for index in xrange(self.ProxyPluginsTAB.log_inject.count()):
                 lines.append(str(self.ProxyPluginsTAB.log_inject.item(index).text()))
             for log in lines: injectionlog.write(log+'\n')
             injectionlog.close()
     with open('/var/lib/dhcp/dhcpd.leases','w') as dhcpLease:
         dhcpLease.write(''),dhcpLease.close()
     self.btn_start_attack.setDisabled(False)
     popen('ulimit -n 1024')
     Refactor.set_ip_forward(0)
     self.TabInfoAP.clearContents()
     if hasattr(self.FormPopup,'Ftemplates'):
         self.FormPopup.Ftemplates.killThread()
         self.FormPopup.StatusServer(False)
开发者ID:BrunoDB,项目名称:WiFi-Pumpkin,代码行数:37,代码来源:Main.py

示例2: StartApFake

# 需要导入模块: from Core.Utils import Refactor [as 别名]
# 或者: from Core.Utils.Refactor import settingsNetworkManager [as 别名]
    def StartApFake(self):
        if len(self.selectCard.currentText()) == 0:
            return QMessageBox.warning(self,'Error interface ','Network interface is not found')
        if not type(self.SoftDependencies()) is bool: return

        self.interfacesLink = Refactor.get_interfaces()
        if len(self.EditGateway.text()) == 0 or self.interfacesLink['activated'] == None:
            return QMessageBox.warning(self,'Internet Connection','No internet connection not found, '
            'sorry WiFi-Pumpkin tool requires an internet connection to mount MITM attack. '
            'check your connection and try again')

        if str(self.selectCard.currentText()) == self.interfacesLink['activated']:
            iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE)
            for line in iwconfig.stdout.readlines():
                if str(self.selectCard.currentText()) in line:
                    return QMessageBox.warning(self,'Wireless Interface',
                    'An connection with {} has been detected '
                    ' : Device or resource busy\n{}'.format(
                    str(self.selectCard.currentText()),line))

        import platform
        if platform.dist()[0] == 'Kali':
            if str(self.interfacesLink['activated']).startswith('wl'):
                return QMessageBox.information(self,'Error network card',
                    'You are connected with interface wireless, try again with local connection')

        dh, gateway = self.PumpSettingsTAB.getPumpkinSettings()['router'],str(self.EditGateway.text())
        if dh[:len(dh)-len(dh.split('.').pop())] == gateway[:len(gateway)-len(gateway.split('.').pop())]:
            return QMessageBox.warning(self,'DHCP Server Settings',
                'The DHCP server check if range ip class is same.'
                'it works, but not share internet connection in some case.\n'
                'for fix this, You need change on tab (Pumpkin-Settings -> Class Ranges)'
                'now you have choose the Class range different of your network.')
        self.btn_start_attack.setDisabled(True)
        popen('ulimit -n 64000')

        self.APactived = self.FSettings.Settings.get_setting('accesspoint','using')
        if self.APactived == 'hostapd':
            self.ConfigTwin['AP_iface'] = str(self.selectCard.currentText())
            if str(self.interfacesLink['activated']).startswith('eth') or \
               str(self.interfacesLink['activated']).startswith('enp'):
                try:
                    check_output(['nmcli','radio','wifi',"off"])
                except Exception:
                    try:
                        check_output(['nmcli','nm','wifi',"off"])
                    except Exception as e:
                        return QMessageBox.warning(self,'Error nmcli',e)
                finally:
                    call(['rfkill', 'unblock' ,'wifi'])
            elif str(self.interfacesLink['activated']).startswith('wl'):
                if not Refactor.settingsNetworkManager(self.ConfigTwin['AP_iface'],Remove=False):
                    return QMessageBox.warning(self,'Network Manager',
                    'Not found file NetworkManager.conf in folder /etc/NetworkManager/')

            leases = '/var/lib/dhcp/dhcpd.leases'
            if not path.exists(leases[:-12]):
                mkdir(leases[:-12])
            if not path.isfile(leases):
                with open(leases,'wb') as leaconf:
                    leaconf.close()
            uid = getpwnam('root').pw_uid
            gid = getgrnam('root').gr_gid
            chown(leases, uid, gid)
            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)

        # thread dhcp
        popen('ifconfig {} up'.format(str(self.selectCard.currentText())))
        selected_dhcp = self.FSettings.Settings.get_setting('accesspoint','dhcp_server')
        if selected_dhcp == 'iscdhcpserver':
            Thread_dhcp = ThRunDhcp(['sudo','dhcpd','-d','-f','-lf','/var/lib/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)

        ##### 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()
        self.Started(True)
        self.ProxyPluginsTAB.GroupSettings.setEnabled(False)
        self.FSettings.Settings.set_setting('accesspoint','statusAP',True)


#.........这里部分代码省略.........
开发者ID:BrunoDB,项目名称:WiFi-Pumpkin,代码行数:103,代码来源:Main.py


注:本文中的Core.Utils.Refactor.settingsNetworkManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。