def run_command(command):
try:
subp = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
subp_output, errors = subp.communicate()
if not errors:
if subp_output == '':
return '[+] Command successfully executed.\n'
else:
return subp_output
return "[!] {}".format(errors)
except KeyboardInterrupt:
print "Terminated command."
评论列表
文章目录