项目作者: dyxushuai

项目描述 :
gRPC dump tool
高级语言: Go
项目地址: git://github.com/dyxushuai/grpcdump.git
创建时间: 2018-06-06T10:46:33Z
项目社区:https://github.com/dyxushuai/grpcdump

开源协议:Apache License 2.0

下载


gRPC dump tool

中文文档

  1. » sudo go run cmd/grpcdump/main.go -d lo0 -port 8085 -ip 127.0.0.1 -proto ./grpc_example/helloworld/helloworld/helloworld.proto
  2. 2018/06/06 21:18:02 Starting capture on device "lo0"
  3. 2018/06/06 21:18:02 reading in packets
  4. REQUEST(STREAM=1) > 2018-06-06T21:18:04.921128144+08:00: 127.0.0.1:56327 ---> 127.0.0.1:8085
  5. HEADERS:
  6. :method = "POST"
  7. :scheme = "http"
  8. :path = "/helloworld.Greeter/SayHello"
  9. :authority = "127.0.0.1:8085"
  10. content-type = "application/grpc"
  11. user-agent = "grpc-go/1.13.0-dev"
  12. te = "trailers"
  13. BODY:
  14. {"name":"world","i18":"zh"}
  15. RESPONSE(STREAM=1) > 2018-06-06T21:18:04.921691304+08:00: 127.0.0.1:56327 <--- 127.0.0.1:8085
  16. HEADERS:
  17. :status = "200"
  18. content-type = "application/grpc"
  19. BODY:
  20. {"message":"Hello, 你好"}
  21. RESPONSE(STREAM=1) > 2018-06-06T21:18:04.921865543+08:00: 127.0.0.1:56327 <--- 127.0.0.1:8085
  22. HEADERS:
  23. grpc-status = "0"
  24. grpc-message = ""

Requirement

Build grpcpdump requires libpcap-dev and cgo enabled.

libpcap

for ubuntu/debian:

  1. sudo apt install libpcap-dev

for centos/redhat/fedora:

  1. sudo yum install libpcap-devel

for osx:

Libpcap and header files already installed.

Install

  1. go get -u github.com/dyxushuai/grpcdump/cmd/grpcdump

Usage

  1. -assembly_debug_log
  2. If true, the github.com/google/gopacket/tcpassembly library will log verbose debugging information (at least one line per packet)
  3. -assembly_memuse_log
  4. If true, the github.com/google/gopacket/tcpassembly library will log information regarding its memory use every once in a while.
  5. -d string
  6. Interface to get packets from (default "eth0")
  7. -ip string
  8. Filter by ip, if either source or target ip is matched, the packet will be processed
  9. -port uint
  10. Filter by port, if either source or target port is matched, the packet will be processed.
  11. -proto string
  12. Protobuf spec file
  13. -v Logs every packet in great detail

Wanted

  • Dump bytes from Network Interface, e.g. “eth0”.
  • Filter by host ip and host port.
  • Parse bytes as HTTP2 protocol.
  • Decrypt TLS sessions by key log.
  • Dynamic reflect the protobuf files at runtime.
  • Pretty print.