Skip to content

Instantly share code, notes, and snippets.

@keegoo
Last active August 27, 2022 16:10
Show Gist options
  • Save keegoo/25ad3e01e416bb597725c0b4c9dfef68 to your computer and use it in GitHub Desktop.
Save keegoo/25ad3e01e416bb597725c0b4c9dfef68 to your computer and use it in GitHub Desktop.
记录如何写一个http proxy in Rust的学习笔记

Briefing

在Mac和Linux下感觉没有好用的http capture的工具。

其实需求很简单:可以monitor某个ip,监控其中发生的http的traffice,并实时的在Web UI中显示出来。

用过Windows平台的Fiddler,感觉非常易用。

想用Rust来写,不过之前对于Rust和网络编程都没有什么经验。

用此gist来一步一步的记录整个学习过程。

2022年6月20号,新加坡。

@keegoo
Copy link
Author

keegoo commented Aug 27, 2022

上面提到./run_scapy会启动一个可交互的console,下面是一个如何在console中操作数据包的例子:

send(IP(dst="1.2.3.4")/TCP(dport=502, options=[("MSS", 0)]))

其中

  • IP和TCP都是class,定义在scapy/layers/inet.py中。
  • send应该是定义在scapy/sendrecv.py中。

(to be continue ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment