AnyProxy抓包实践

简介: AnyProxy抓包实践

本质是中间人攻击(man-in-the-middle attack)


文档:

https://github.com/alibaba/anyproxy/blob/master/docs/cn/src_doc.md


安装

npm install -g anyproxy

启动

anyproxy

编写处理规则

rule.js

module.exports = {
    // 模块介绍
    summary: 'my customized rule for AnyProxy',
    // 发送请求前拦截处理
    *beforeSendRequest(requestDetail) { /* ... */ },
    // 发送响应前处理
    *beforeSendResponse(requestDetail, responseDetail) { /* ... */ },
    // 是否处理https请求
    *beforeDealHttpsRequest(requestDetail) { /* ... */ },
    // 请求出错的事件
    *onError(requestDetail, error) { /* ... */ },
    // https连接服务器出错
    *onConnectError(requestDetail, error) { /* ... */ }
};

demo

// file: sample.js
module.exports = {
  summary: 'a rule to hack response',
  *beforeSendResponse(requestDetail, responseDetail) {
    if (requestDetail.url === 'http://httpbin.org/user-agent') {
      const newResponse = responseDetail.response;
      newResponse.body += '- AnyProxy Hacked!';
      return { response: newResponse };
    }
  },
};

使用rule规则

anyproxy --rule ./sample.js

测试

curl https://github.com --proxy http://127.0.0.1:8001


相关文章
|
9月前
|
Linux
利用wireshark抓包分析
利用wireshark抓包分析
74 0
|
应用服务中间件 nginx
wireshark抓包入门使用教程
wireshark抓包入门使用教程
844 0
wireshark抓包入门使用教程
|
6月前
|
Web App开发 安全 前端开发
『Fiddler数据抓包功攻略』| 如何使用Fiddler进行数据抓包与分析?
『Fiddler数据抓包功攻略』| 如何使用Fiddler进行数据抓包与分析?
115 0
|
7月前
|
域名解析 存储 缓存
通过Wireshark抓包分析谈谈DNS域名解析的那些事儿
通过Wireshark抓包分析谈谈DNS域名解析的那些事儿
219 0
|
8月前
|
网络协议
Wireshark 抓包工具介绍
Wireshark 抓包工具介绍
79 0
|
网络协议
WireShark抓包分析
WireShark抓包分析
119 0
|
网络协议
Wireshark基础及使用
Wireshark-- 网络分析工具 基础及使用
Wireshark基础及使用
|
网络协议 Linux 网络架构
快速学习多协议抓包利器Wireshark
快速学习多协议抓包利器Wireshark
206 0
|
anyproxy
AnyProxy抓包实践
AnyProxy抓包实践
263 0
|
网络协议
计算机网络实验【利用wireshark抓包工具抓包】
计算机网络实验【利用wireshark抓包工具抓包】
379 0
计算机网络实验【利用wireshark抓包工具抓包】