subprocess.run不能获得所有输出
环境win10 vscode/idle
import subprocess
def runcommand():
cmd= "python3 C:/Users/user/Desktop/sqlmap/sqlmap.py -u http://testphp.vulnweb.com/listproducts.php?cat=1"+" --dbs -v0 -batch"
print(cmd)
cmd_result = subprocess.run(cmd,shell=True,capture_output=True,text=True)
output = cmd_result.stdout
print(output)
if __name__ == "__main__":
runcommand()
不知道为何卡在开始的start 我曾经把代码发给朋友 他可以正常运行
目标:这是正常运行的输出界面
我曾经在虚拟机也运行过 但也卡在start 之前这代码我也是可以正常运行的 我可以确定路径是对的 所以朋友认为是我电脑的问题 是电脑的設定问题 ?有人知道原因嗎
试过把代码cmd=”ipconfig” subprocess.run 也是可以正常运行的 都可以看到所有输出 但最近不知啥原因卡在start了
试过把python3 C:/Users/user/Desktop/sqlmap/sqlmap.py -u testphp.vulnweb.com/listproducts.ph... –dbs -v0 -batch 直接放在cmd也是可以运行的 像图2的右方输出一樣
尝试了這樣,都不行 也是卡在start
cmd_result = subprocess.run(
cmd, shell=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(cmd_result.stdout)
我又开了新的虚拟机 把代码放进去 在虚拟机又正常运作了 但我的主电脑还是不能运作 原因是?
上面是主电脑的sqlmap
*不是代码的问题
這error和我的sqlmap輸出停在start有关嗎?
推荐文章: