代码改变世界

查看ps和dumpsys netpolicy

2017-06-22 18:11  黄阿星  阅读(272)  评论(0)    收藏  举报
import os
import time

file = "data.txt"
text = os.popen("adb shell ps | findstr com.tencent")
fw = open(file,'w')

for line in text.readlines():
#print line
fw.write(line+'\n')
num = line.split(" ")[0]
back = os.popen("adb shell dumpsys netpolicy | findstr " + num[4:])
fw.write(back.read())
fw.close()