轻松分析网络流量
network-analyzer的Python项目详细描述
网络分析仪
安装
克隆存储库并转到其根文件夹并运行:
sudo pip install -e .
运行服务器
使用PM2
通过http和websocket运行json-rpc服务器:
pm2 start pm2.json
使用shell脚本
在端口5000上通过http运行json-rpc服务器:
sh scripts/serve_rpc.sh
要在端口5050上通过Web套接字(socket.io)运行RPC服务器:
sh scripts/serve_socket.sh
客户机
Python(2.7)
- 通过运行: 安装json-rpc客户端
tinyrpc
sudo pip install tinyrpc
- 访问JSON-RPCAPI的Python2.7客户端代码示例
fromtinyrpc.protocols.jsonrpcimportJSONRPCProtocolfromtinyrpc.transports.httpimportHttpPostClientTransportfromtinyrpcimportRPCClientrpc_client=RPCClient(JSONRPCProtocol(),HttpPostClientTransport('http://localhost:5000/v1/jsonrpc'))rpc_server=rpc_client.get_proxy()print"pinging..."pong=rpc_server.ping()print"ping response: "+pongresp=rpc_server.hello("John")print"hello world response: "+resp