python脚本获取当前Android流量
来源:互联网 发布:线性同余法 PHP 编辑:程序博客网 时间:2024/06/04 19:48
import time#use to control timeimport subprocessimport osfrom color import *##############################这里要进入自己adb目录。每个人根据自己的adb 目录设置# 注意用的是反斜杠############################adb_path='C:/Users/lvbiao/Desktop/adb'os.chdir(adb_path)Uid_cmd = 'adb shell "dumpsys package com.unisound.ant.platform.hardware | grep userId"'def getUid( ):#获取UID p1 = subprocess.Popen(Uid_cmd, shell=True, stdout=subprocess.PIPE); uidLongString = p1.stdout.read() uid_info = uidLongString.decode('UTF-8','strict') uidLongList = uid_info.split() uidMap = uidLongList[0] #print ("uidmap====" + uidMap ) uid= uidMap.split("=") #print("uid1===" + uid[1]) uid =uid[1] #print ("str is = " + uid ) return uidRev_cmd = 'adb shell "cd proc && cd uid_stat && cd '+ getUid( ) +' && cat tcp_rcv"'def getRev():#获取某个APP的TCP下载流量 p_rev = subprocess.Popen(Rev_cmd, shell=True, stdout=subprocess.PIPE); flo_rec =int(p_rev.stdout.read()) #print ("flo_rec" + str(flo_rec)) clr.print_red_text("com.unisound.ant.platform.hardware recv Bytes ") clr.print_red_text("RECV BYTES is =" + str(flo_rec)) clr.print_red_text("========end===========") return flo_rec SEN_cmd = 'adb shell "cd proc && cd uid_stat && cd '+ getUid( ) +' && cat tcp_snd"'def getSEN():#获取某个APP的TCP下载流量 p_rev = subprocess.Popen(SEN_cmd, shell=True, stdout=subprocess.PIPE); flo_sen =int(p_rev.stdout.read()) #print ("flo_sen" + str(flo_sen)) clr.print_blue_text("========================") clr.print_blue_text("com.unisound.ant.platform.hardware SEND Bytes ") clr.print_blue_text("SEND BYTES is =" + str(flo_sen)) clr.print_blue_text("========end===========") return flo_senclr = Color() while 1: getUid( ) time.sleep(1) getRev() time.sleep(1) getSEN() time.sleep(1)
实时监控系统收发的系统流量。监控的好工具
阅读全文
0 0
- python脚本获取当前Android流量
- Python获取当前脚本绝对路径
- python 获取当前脚本所在路径
- Python 获取当前脚本文件路径目录
- python获取当前脚本路径(非常好用)
- python获取当前脚本文件路径
- python流量监控脚本
- iphone获取当前流量信息
- 使用python编写脚本获取手机当前应用的信息
- python获取当前脚本下的所有方法
- Python获取当前脚本文件路径(支持py2exe)
- Python:获取当前脚本路径的姿势对比
- 获取当前脚本绝对路径
- Android获取流量信息
- shell脚本之获取网卡实时流量
- shell脚本获取网卡的实时流量
- 【python脚本】-刷CSDN博客流量
- 获取当前脚本的信息
- Maven安装指定的文件到本地仓库。
- 进程、信号简笔
- Eclipse中安装ADT插件
- Java 格式化xml字符串
- include“stdio.h”和<stdio.h>的区别
- python脚本获取当前Android流量
- 在listview recycleview里显示高德地图
- 远程桌面管理工具RDCMan
- Python实现发邮件
- matalb等笔记
- Linux命令之ifconfig
- VS2015 + PCL1.8.0 + QT_5.62 + cmake3.82 编译VTK7.1,生成QVTKWidgetPlugin.dll
- 杂感
- JAVA 自定义动态代理实现