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


Python execute.execute函数代码示例

本文整理汇总了Python中execute.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wpa_run

    def wpa_run(self):
        dump_cmd = ['airodump-ng', '-c', self.channel, '--bssid', self.bssid, '-w', './log/' + self.bssid, self.iface]
        airodump_proc = Popen(dump_cmd, stdout=DN, stderr=DN)
        self.proc_list.append(airodump_proc)

        self.send_deauths()
        while self.key == '':
            output = Popen('tshark -r ./log/' + self.bssid + '-01.cap 2>/dev/null| grep "Message 4 of 4"',shell=True, stdout=PIPE).communicate()[0]
            if output.find('Message 4 of 4') != -1:
                execute('rm ./log/'+self.bssid+'.key')
                airodump_proc.kill()
                airodump_proc.communicate()
                crack_cmd = ['aircrack-ng', '-w', self.password_list, '-b', self.bssid, './log/' + self.bssid + '-01.cap','-l', './log/' + self.bssid + '.key']
                crack_proc = Popen(crack_cmd, stdout=DN)
                self.proc_list.append(crack_proc)
                crack_proc.wait()
                try:
                    f = open('./log/' + self.bssid + '.key')
                    key = f.read()
                    f.close()
                    self.key = key
                    self.crack_success = True
                    self.stop()
                except:
                    pass
            else:
                self.send_deauths()
                time.sleep(5)
        return self.key
开发者ID:kn9,项目名称:AtEar,代码行数:29,代码来源:aircrack.py

示例2: purge

 def purge(self, cr, uid, vals, context={}):
     context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
     ssh, sftp = execute.connect(vals['backup_fullname'], context=context)
     execute.execute(ssh, ['rm', '-rf', '/opt/backup/simple/' + vals['saverepo_name'] + '/'+ vals['save_name']], context)
     ssh.close()
     sftp.close()
     return
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:7,代码来源:save.py

示例3: stop_monitor

def stop_monitor():
    '''
        @brief Delete wlan device.
    '''
    for dev in _dev_name_list:
        execute('iw dev '+ dev +' del > /dev/null 2>&1')
    w_interface_up()
开发者ID:onexuan,项目名称:AtEar,代码行数:7,代码来源:network.py

示例4: deploy_post

 def deploy_post(self, cr, uid, vals, context):
     super(saas_container, self).deploy_post(cr, uid, vals, context)
     context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
     if vals['apptype_name'] == 'docker':
         ssh, sftp = execute.connect(vals['container_fullname'], context=context)
         execute.execute(ssh, ['echo "host all  all    ' + vals['container_options']['network']['value'] + ' md5" >> /etc/postgresql/' + vals['app_current_version'] + '/main/pg_hba.conf'], context)
         execute.execute(ssh, ['echo "listen_addresses=\'' + vals['container_options']['listen']['value'] + '\'" >> /etc/postgresql/' + vals['app_current_version'] + '/main/postgresql.conf'], context)
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:7,代码来源:docker.py

示例5: purge

 def purge(self, cr, uid, vals, context={}):
     context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
     if 'shinken_server_domain' in vals:
         ssh, sftp = execute.connect(vals['shinken_fullname'], context=context)
         execute.execute(ssh, ['rm', vals['server_shinken_configfile']], context)
         execute.execute(ssh, ['/etc/init.d/shinken', 'reload'], context)
         ssh.close()
         sftp.close()
开发者ID:ajite,项目名称:odoo-hosting-orchestrator,代码行数:8,代码来源:container.py

示例6: start

 def start(self, cr, uid, vals, context={}):
     context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
     self.stop(cr, uid, vals, context=context)
     ssh, sftp = execute.connect(vals['server_domain'], vals['server_ssh_port'], 'root', context)
     execute.execute(ssh, ['docker', 'start', vals['container_name']], context)
     ssh.close()
     sftp.close()
     time.sleep(3)
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:8,代码来源:container.py

示例7: purge_files

    def purge_files(self, cr, uid, vals, context={}):
        context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
        ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context)
        execute.execute(ssh, ['rm', '-rf', vals['service_full_localpath_files']], context)
        ssh.close()
        sftp.close()

        self.check_files(cr, uid, vals, context=context)
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:8,代码来源:service.py

示例8: purge

    def purge(self, cr, uid, vals, context={}):
        context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})

        #TODO we need to launch a direct command, without ssh
        ssh, sftp = execute.connect('localhost', 22, 'saas-conductor', context)
        execute.execute(ssh, ['sed', '-i', "'/Host " + vals['server_domain'] + "/,/END " + vals['server_domain'] + "/d'", vals['config_home_directory'] + '/.ssh/config'], context)
        ssh.close()
        sftp.close()
        execute.execute_local(['rm', '-rf', vals['config_home_directory'] + '/.ssh/keys/' + vals['server_domain']], context)
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:9,代码来源:container.py

示例9: run

 def run(self):
     ''' Start airodump-ng and dump '''
     # Clean first
     self.stop()
     remove_command = 'rm -rf ' + self.air_scan_result + '*'
     execute(remove_command)
     dump_command = ['airodump-ng', self.iface, '-w', self.air_scan_result, '--output-format', 'csv']
     self.dump_proc, unused_ret, unused_out, unused_err = execute(dump_command, wait=False)
     self.isRunning = True
开发者ID:kn9,项目名称:AtEar,代码行数:9,代码来源:airodump.py

示例10: w_interface_up

def w_interface_up():
    p, retval, out, err = execute('iw dev |grep Interface')
    intf_list = out.replace('\tInterface','').split()
    for interface in intf_list:
        execute('ifconfig ' + interface + ' up')



#print get_interfaces()
开发者ID:NORMA-Inc,项目名称:AtEar,代码行数:9,代码来源:network.py

示例11: main

def main ():
    logging.basicConfig(stream=sys.stdout, level=logging.INFO)

    for locale in CONFIGURATION.locales:
        merge(locale)
    # Dummy text is not required. Don't raise exception if files are missing.
    merge(CONFIGURATION.dummy_locale, fail_if_missing=False)
    compile_cmd = 'django-admin.py compilemessages'
    execute(compile_cmd, working_directory=BASE_DIR)
开发者ID:fbagirov,项目名称:edx-platform,代码行数:9,代码来源:generate.py

示例12: check_files

    def check_files(self, cr, uid, vals, context={}):
        context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
        service_ids = self.search(cr, uid, [('application_version_id', '=', vals['app_version_id']),('container_id.server_id','=',vals['server_id'])], context=context)
	if vals['service_id'] in service_ids:
	    service_ids.remove(vals['service_id'])
        if not service_ids:
            ssh, sftp = execute.connect(vals['server_domain'], vals['server_ssh_port'], 'root', context)
            execute.execute(ssh, ['rm', '-rf', vals['app_version_full_hostpath']], context)
            ssh.close()
            sftp.close()
开发者ID:YannickB,项目名称:saas-deprecated,代码行数:10,代码来源:service.py

示例13: deploy

 def deploy(self, cr, uid, vals, context={}):
     context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid})
     _logger.info('test %s', vals['shinken_server_domain'])
     if 'shinken_server_domain' in vals:
         ssh, sftp = execute.connect(vals['shinken_fullname'], context=context)
         sftp.put(vals['config_conductor_path'] + '/saas/saas_shinken/res/server-shinken.config', vals['server_shinken_configfile'])
         execute.execute(ssh, ['sed', '-i', '"s/NAME/' + vals['server_domain'] + '/g"', vals['server_shinken_configfile']], context)
         execute.execute(ssh, ['/etc/init.d/shinken', 'reload'], context)
         ssh.close()
         sftp.close()
开发者ID:ajite,项目名称:odoo-hosting-orchestrator,代码行数:10,代码来源:container.py

示例14: set_monitor_mode

def set_monitor_mode():
    '''
        @brief Set wlan device to monitor mode.
        @return:
            * success - True
            * fail - False
    '''
    for dev in _mon_dev_list:
        execute('iwconfig '+ dev +' mode monitor')
        time.sleep(1)
        p, retval, out, err = execute('iwconfig '+ dev)

        retry = 0
        while out.find('Mode:Monitor') == -1: # If the mode is not changed properly, enter the loop and retry 60.
            execute('ifconfig '+dev+' down')
            execute('iwconfig '+ dev +' mode monitor')
            time.sleep(0.5)
            p, retval, out, err = execute('iwconfig '+ dev)
            retry = retry + 1
            if retry == 150:
                break

    time.sleep(2)
    for dev in _mon_dev_list: # Reaffirm
        p, retval, out, err = execute('iwconfig '+ dev)
        if out.find('Mode:Monitor') == -1:
            return False

    return True
开发者ID:onexuan,项目名称:AtEar,代码行数:29,代码来源:network.py

示例15: purge_key

 def purge_key(self, cr, uid, vals, context={}):
     ssh, sftp = execute.connect('localhost', 22, 'saas-conductor', context)
     execute.execute(ssh, ['sed', '-i', "'/Host " + vals['container_fullname'] + "/,/END " + vals['container_fullname'] + "/d'", vals['config_home_directory'] + '/.ssh/config'], context)
     ssh.close()
     sftp.close()
     execute.execute_local(['rm', '-rf', vals['config_home_directory'] + '/.ssh/keys/' + vals['container_fullname']], context)
     execute.execute_local(['rm', '-rf', vals['config_home_directory'] + '/.ssh/keys/' + vals['container_fullname'] + '.pub'], context)
     ssh, sftp = execute.connect(vals['server_domain'], vals['server_ssh_port'], 'root', context)
     execute.execute(ssh, ['rm', '-rf', '/opt/keys/' + vals['container_fullname'] + '/authorized_keys'], context)
     ssh.close()
     sftp.close()
开发者ID:ajite,项目名称:odoo-hosting-orchestrator,代码行数:11,代码来源:container.py


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