當前位置: 首頁>>代碼示例>>Python>>正文


Python commands.getoutput方法代碼示例

本文整理匯總了Python中commands.getoutput方法的典型用法代碼示例。如果您正苦於以下問題:Python commands.getoutput方法的具體用法?Python commands.getoutput怎麽用?Python commands.getoutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在commands的用法示例。


在下文中一共展示了commands.getoutput方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname
         
        listoutput=commands.getoutput("airodump-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip()+" "+\
                            format(self.var9.get())+" "+(self.t9.get(1.0, 'end')).strip()+" "+format(self.var10.get())+" "+(self.t10.get(1.0, 'end')).strip()+" "+format(self.var11.get())+" "+(self.t11.get(1.0, 'end')).strip()+" "+format(self.var12.get())+" "+(self.t12.get(1.0, 'end')).strip()+" "+\
                            format(self.var13.get())+" "+(self.t13.get(1.0, 'end')).strip()+" "+format(self.var14.get())+" "+(self.t14.get(1.0, 'end')).strip()+" "+format(self.var15.get())+" "+(self.t15.get(1.0, 'end')).strip()+" "+format(self.var16.get())+" "+(self.t16.get(1.0, 'end')).strip()+" "+\
                            format(self.var17.get())+" "+(self.t17.get(1.0, 'end')).strip()+" "+format(self.var18.get())+" "+(self.t18.get(1.0, 'end')).strip()+" "+format(self.var19.get())+" "+(self.t19.get(1.0, 'end')).strip()+" "+format(self.var20.get())+" "+(self.t20.get(1.0, 'end')).strip()+" "+\
                            format(self.var21.get())+" "+ (self.t21.get(1.0, 'end')).strip()+" "+format(self.var22.get())+" "+(self.t22.get(1.0, 'end')).strip()+" "+format(self.var23.get())+" "+(self.t23.get(1.0, 'end')).strip()+" "+format(self.var24.get())+" "+(self.t24.get(1.0, 'end')).strip()+" "+\
                            format(self.var25.get())+" "+(self.t25.get(1.0, 'end')).strip()+" "+format(self.var26.get())+" "+(self.t26.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)
       
      
        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:23,代碼來源:Airodump-ng.py

示例2: portScan

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def portScan(ip,user,password):
	try:
		result={}
		with open("result.json","r") as fn:
			data=fn.readlines()
			fn.close()
			result=json.loads(data[0])
		result[u"ip"]=ip
		result[u"username"]=user
		result[u"password"]=password
		#進行端口掃描
		print u"[*]對主機%s進行端口掃描......"%ip
		commandResult=commands.getoutput("python port_scan.py %s"%ip)
		result[u"端口詳情"]=ast.literal_eval(commandResult)
		#將主機信息,端口掃描信息保存到json中
		with open("result.json",'w') as fn:
			json.dump(result,fn,ensure_ascii=False)
			fn.close()
		print u"[+]本次端口掃描結束"
	except Exception as e:
		print u"[-]端口掃描失敗,請重新掃描"
		print e 
開發者ID:vulscanteam,項目名稱:vulscan,代碼行數:24,代碼來源:main.py

示例3: detect_desktop_environment

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def detect_desktop_environment():
        '''Checks for known desktop environments

        Return the desktop environments name, lowercase (kde, gnome, xfce)
        or "generic"

        '''

        desktop_environment = 'generic'

        if os.environ.get('KDE_FULL_SESSION') == 'true':
            desktop_environment = 'kde'
        elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):
            desktop_environment = 'gnome'
        else:
            try:
                info = commands.getoutput('xprop -root _DT_SAVE_MODE')
                if ' = "xfce4"' in info:
                    desktop_environment = 'xfce'
            except (OSError, RuntimeError):
                pass

        return desktop_environment 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:25,代碼來源:email.py

示例4: show

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def show(self,ntime):
    data = self.data
    which = data.findtime(ntime)
    time,box,atoms,bonds,tris,lines = data.viz(which)
    if self.boxflag == 2: box = data.maxbox()
    self.distance = compute_distance(box)

    self.xtrans = self.ytrans = self.ztrans = 0.0
    output = self.single(1,self.file,box,atoms,bonds,tris,lines)
    print output
    nums = re.findall("translation to:\s*(\S*)\s*(\S*)\s*(\S*)\s",output)
    self.xtrans = float(nums[0][0])
    self.ytrans = float(nums[0][1])
    self.ztrans = float(nums[0][2])
    
    self.single(0,self.file,box,atoms,bonds,tris,lines)
    cmd = "%s %s.png" % (PIZZA_DISPLAY,self.file)
    commands.getoutput(cmd)

  # -------------------------------------------------------------------- 
開發者ID:lammps,項目名稱:pizza,代碼行數:22,代碼來源:raster.py

示例5: slot_autoload_victim_clients

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def slot_autoload_victim_clients(self):
        
        # clear
        self.combo_wep_mac_cfrag.clear()
        self.combo_wpa_mac_hand.clear()

        # check *.csv files
        if not glob.glob(config_dir + "*.csv"):
            self.output("no csv files in " + config_dir, 1)
            return
        
        # open dump file
        dump_file = commands.getoutput("cat " + config_dir + "*.csv | egrep -e '^[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}.+[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2}:[0-9a-fA-F]{2,2},' | grep " + self.ac + " | tr ',' ' ' | awk ' { print $1 } '")
        dump_file = dump_file.split('\n')        
        
        for mac in dump_file:
            self.combo_wep_mac_cfrag.insertItem(0, mac)
            self.combo_wpa_mac_hand.insertItem(0, mac)

    #
    # Add cracked key to database
    # 
開發者ID:Frozenbox,項目名稱:airmode,代碼行數:24,代碼來源:airmode.py

示例6: replay_pcr_data

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def replay_pcr_data(pcr_list):
    info_print('Replay TPM data.\n')
    check_and_run_resource_manager()

    for pcr_data in pcr_list:
        info_print('    [>>] PCR %s, SHA256 = %s\n' % (pcr_data[0], pcr_data[1]))
        output = commands.getoutput('tpm2_extendpcrs -g 0x0b -P %s -i %s' % (pcr_data[0], pcr_data[1]))
        print output + '\n'

    # Last one for PCR #7
    info_print('    [>>] Last PCR 7, SHA256 = %s\n' % (sha256_bootmgfw_cert))
    output = commands.getoutput('tpm2_extendpcrs -g 0x0b -P 7 -i %s' % sha256_bootmgfw_cert)
    print output + '\n'

    os.system('sudo killall resourcemgr')
    
# 
# Extract TPM encoded blob from Dislocker tool
# 
開發者ID:kkamagui,項目名稱:bitleaker,代碼行數:21,代碼來源:bitleaker.py

示例7: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
	listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname

        listoutput=commands.getoutput("airtun-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip()+" "+format(self.var9.get())+" "+(self.t9.get(1.0, 'end')).strip()+" "+format(self.var10.get())+" "+(self.t10.get(1.0, 'end')).strip()+" "+format(self.var11.get())+" "+(self.t11.get(1.0, 'end')).strip()+" "+format(self.var12.get())+" "+(self.t12.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)

        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:18,代碼來源:Airtun-ng.py

示例8: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname
         
        listoutput=commands.getoutput("aircrack-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip()+" "+\
                            format(self.var9.get())+" "+(self.t9.get(1.0, 'end')).strip()+" "+format(self.var10.get())+" "+(self.t10.get(1.0, 'end')).strip()+" "+format(self.var11.get())+" "+(self.t11.get(1.0, 'end')).strip()+" "+format(self.var12.get())+" "+(self.t12.get(1.0, 'end')).strip()+" "+\
                            format(self.var13.get())+" "+(self.t13.get(1.0, 'end')).strip()+" "+format(self.var14.get())+" "+(self.t14.get(1.0, 'end')).strip()+" "+format(self.var15.get())+" "+(self.t15.get(1.0, 'end')).strip()+" "+format(self.var16.get())+" "+(self.t16.get(1.0, 'end')).strip()+" "+\
                            format(self.var17.get())+" "+(self.t17.get(1.0, 'end')).strip()+" "+format(self.var18.get())+" "+(self.t18.get(1.0, 'end')).strip()+" "+format(self.var19.get())+" "+(self.t19.get(1.0, 'end')).strip()+" "+format(self.var20.get())+" "+(self.t20.get(1.0, 'end')).strip()+" "+\
                            format(self.var21.get())+" "+ (self.t21.get(1.0, 'end')).strip()+" "+format(self.var22.get())+" "+(self.t22.get(1.0, 'end')).strip()+" "+format(self.var23.get())+" "+(self.t23.get(1.0, 'end')).strip()+" "+format(self.var24.get())+" "+(self.t24.get(1.0, 'end')).strip()+" "+\
                            format(self.var25.get())+" "+(self.t25.get(1.0, 'end')).strip()+" "+format(self.var26.get())+" "+(self.t26.get(1.0, 'end')).strip()+" "+format(self.var27.get())+" "+(self.t27.get(1.0, 'end')).strip()+" "+format(self.var28.get())+" "+(self.t28.get(1.0, 'end')).strip()+" "+format(self.var29.get())+" "+(self.t29.get(1.0, 'end')).strip()+" "+format(self.var30.get())+" "+(self.t30.get(1.0, 'end')).strip()+" "+format(self.var31.get())+" "+(self.t31.get(1.0, 'end')).strip()+" "+format(self.var32.get())+" "+(self.t32.get(1.0, 'end')).strip()+" "+format(self.var33.get())+" "+(self.t33.get(1.0, 'end')).strip()+" "+format(self.var34.get())+" "+(self.t34.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)  

        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:23,代碼來源:Aircrack-ng.py

示例9: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname
         
        listoutput=commands.getoutput("airbase-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip()+" "+\
                            format(self.var9.get())+" "+(self.t9.get(1.0, 'end')).strip()+" "+format(self.var10.get())+" "+(self.t10.get(1.0, 'end')).strip()+" "+format(self.var11.get())+" "+(self.t11.get(1.0, 'end')).strip()+" "+format(self.var12.get())+" "+(self.t12.get(1.0, 'end')).strip()+" "+\
                            format(self.var13.get())+" "+(self.t13.get(1.0, 'end')).strip()+" "+format(self.var14.get())+" "+(self.t14.get(1.0, 'end')).strip()+" "+format(self.var15.get())+" "+(self.t15.get(1.0, 'end')).strip()+" "+format(self.var16.get())+" "+(self.t16.get(1.0, 'end')).strip()+" "+\
                            format(self.var17.get())+" "+(self.t17.get(1.0, 'end')).strip()+" "+format(self.var18.get())+" "+(self.t18.get(1.0, 'end')).strip()+" "+format(self.var19.get())+" "+(self.t19.get(1.0, 'end')).strip()+" "+format(self.var20.get())+" "+(self.t20.get(1.0, 'end')).strip()+" "+\
                            format(self.var21.get())+" "+ (self.t21.get(1.0, 'end')).strip()+" "+format(self.var22.get())+" "+(self.t22.get(1.0, 'end')).strip()+" "+format(self.var23.get())+" "+(self.t23.get(1.0, 'end')).strip()+" "+format(self.var24.get())+" "+(self.t24.get(1.0, 'end')).strip()+" "+\
                            format(self.var25.get())+" "+(self.t25.get(1.0, 'end')).strip()+" "+format(self.var26.get())+" "+(self.t26.get(1.0, 'end')).strip()+" "+format(self.var27.get())+" "+(self.t27.get(1.0, 'end')).strip()+" "+format(self.var28.get())+" "+(self.t28.get(1.0, 'end')).strip()+" "+format(self.var29.get())+" "+(self.t29.get(1.0, 'end')).strip()+" "+format(self.var30.get())+" "+(self.t30.get(1.0, 'end')).strip()+" "+format(self.var31.get())+" "+(self.t31.get(1.0, 'end')).strip()+" "+format(self.var32.get())+" "+(self.t32.get(1.0, 'end')).strip()+" "+format(self.var33.get())+" "+(self.t33.get(1.0, 'end')).strip()+" "+format(self.var34.get())+" "+(self.t34.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)  
      
        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:23,代碼來源:Airbase-ng.py

示例10: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname

        listoutput=commands.getoutput("airolib-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip())

        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:18,代碼來源:Airolib-ng.py

示例11: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname

        listoutput=commands.getoutput("airdecap-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)

        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:18,代碼來源:Airdecap-ng.py

示例12: mycallback

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def mycallback(self):
         
        listselection=""
	try:
		listselection=self.lilnew1.get(self.lilnew1.curselection()[0])
	except:
		listselection=""
		
	h1="mon0"
	print listselection
	print self.fname

        listoutput=commands.getoutput("airdecloak-ng"+" "+format(self.var1.get())+" "+(self.t1.get(1.0, 'end')).strip()+" "+format(self.var2.get())+" "+(self.t2.get(1.0, 'end')).strip()+" "+format(self.var3.get())+" "+(self.t3.get(1.0, 'end')).strip()+" "+format(self.var4.get())+" "+(self.t4.get(1.0, 'end')).strip()+" "+\
                            format(self.var5.get())+" "+(self.t5.get(1.0, 'end')).strip()+" "+format(self.var6.get())+" "+(self.t6.get(1.0, 'end')).strip()+" "+format(self.var7.get())+" "+(self.t7.get(1.0, 'end')).strip()+" "+format(self.var8.get())+" "+(self.t8.get(1.0, 'end')).strip()+" "+listselection+" "+self.fname)

        self.output.insert(INSERT,listoutput) 
開發者ID:hiteshchoudhary,項目名稱:Airvengers,代碼行數:18,代碼來源:Airdecloak-ng.py

示例13: get_my_ip

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def get_my_ip():
    """
    Try to obtain our external ip (from the pyro nameserver's point of view)

    This tries to sidestep the issue of bogus `/etc/hosts` entries and other
    local misconfigurations, which often mess up hostname resolution.

    If all else fails, fall back to simple `socket.gethostbyname()` lookup.

    """
    import socket
    try:
        import Pyro4
        # we know the nameserver must exist, so use it as our anchor point
        ns = Pyro4.naming.locateNS()
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect((ns._pyroUri.host, ns._pyroUri.port))
        result, port = s.getsockname()
    except:
        try:
            # see what ifconfig says about our default interface
            import commands
            result = commands.getoutput("ifconfig").split("\n")[1].split()[1][5:]
            if len(result.split('.')) != 4:
                raise Exception()
        except:
            # give up, leave the resolution to gethostbyname
            result = socket.gethostbyname(socket.gethostname())
    return result 
開發者ID:loretoparisi,項目名稱:word2vec-twitter,代碼行數:31,代碼來源:word2vecReaderUtils.py

示例14: get_gpu_temp

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def get_gpu_temp():
    gpu_temp = commands.getoutput( '/opt/vc/bin/vcgencmd measure_temp' ).replace( 'temp=', '' ).replace( '\'C', '' )
    return float(gpu_temp)
    # Uncomment the next line if you want the temp in Fahrenheit
    # return float(1.8* gpu_temp)+32 
開發者ID:spoonysonny,項目名稱:SAKS-SDK,代碼行數:7,代碼來源:main.py

示例15: getstatus

# 需要導入模塊: import commands [as 別名]
# 或者: from commands import getoutput [as 別名]
def getstatus(file):
    """Return output of "ls -ld <file>" in a string."""
    import warnings
    warnings.warn("commands.getstatus() is deprecated", DeprecationWarning, 2)
    return getoutput('ls -ld' + mkarg(file))


# Get the output from a shell command into a string.
# The exit status is ignored; a trailing newline is stripped.
# Assume the command will work with '{ ... ; } 2>&1' around it..
# 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:13,代碼來源:commands.py


注:本文中的commands.getoutput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。