Python3监控linux服务器的http请求


监控v2-ray所在服务器HTTP请求

工具 版本
linux的版本: Debian 9 x86_64
Python版本: 3.6
httpry 0.1.8-1.el7

在linux上下载http监控工具httpry

yum install httpry

安装httpry
在linux上安装subprocess模块

pip3 install subprocess

subprocess官网
Python代码

import subprocess
order='httpry'
pi= subprocess.Popen(order,shell=True,stdout=subprocess.PIPE)
while(1==1):
    for i in iter(pi.stdout.readline,'b'):
        print(i.decode('utf-8'))

说明:在jupyter中运行此代码,连接v2-ray去访问几个页面,然后多刷新几次,过一会jupyter会出现httpry的命令的输出。
代码输出
输出的字符没有弄的很好看。下一步考虑将数据可视化。准备采用Django。可以关注我的github https://github.com/realwuxiong/httpry


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM