本文整理汇总了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)
示例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
示例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
示例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)
# --------------------------------------------------------------------
示例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
#
示例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
#
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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
示例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..
#