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抓包分析
71 0
|
应用服务中间件 nginx
wireshark抓包入门使用教程
wireshark抓包入门使用教程
832 0
wireshark抓包入门使用教程
|
6月前
|
Web App开发 安全 前端开发
『Fiddler数据抓包功攻略』| 如何使用Fiddler进行数据抓包与分析?
『Fiddler数据抓包功攻略』| 如何使用Fiddler进行数据抓包与分析?
110 0
|
8月前
|
网络协议
Wireshark 抓包工具介绍
Wireshark 抓包工具介绍
75 0
|
12月前
|
网络协议
WireShark抓包分析
WireShark抓包分析
116 0
|
网络协议 网络安全
wireshark流量分析入门
wireshark流量分析入门
|
缓存 网络协议 Linux
计算机网络 课程大作业:利用Wireshark抓包并进行分析
计算机网络 课程大作业:利用Wireshark抓包并进行分析
533 0
计算机网络 课程大作业:利用Wireshark抓包并进行分析
|
网络协议 Linux 网络架构
快速学习多协议抓包利器Wireshark
快速学习多协议抓包利器Wireshark
205 0
|
anyproxy
AnyProxy抓包实践
AnyProxy抓包实践
260 0
|
机器学习/深度学习 大数据 应用服务中间件

热门文章

最新文章