anyproxy-windows platform installation and grab the phone app on https requests

Foreword

Do interface testing certainly can not do without capture, the more popular packet capture tool is fiddler and charles, believe not new. Here are a research and development of a capture Ali artifact, simply open the web page, you can catch http and https requests on the phone app.
So there is a benefit when a company test team more than one person, just build a AnyProxy service, open the page on the browser AnyProxy other small partners, will be able to set up a proxy brush brush is caught requested on the phone.
Solve the junior partner fiddler life and death of people without serious computer problems can not catch https requests, but also solve the problem of crack charles installed, do not take up every issue computers to install a packet capture tool.
AnyProxy perfect solution for cross-platform use, whether you are a windows computer, mac computers, mobile app, simply set up a service, can catch the interface request data.

AnyProxy Profile

AnyProxy is an open HTTP proxy server. Github Home: https://github.com/alibaba/anyproxy

Key features include:

  • Node.js based, open secondary development, allows custom request processing logic
  • Https of analytical support
  • GUI interface, a request for observation

Compared 3.x version, AnyProxy 4.0 of the main changes:

  • Rule file (Rule) and full support for Promise Generator
  • It simplifies the interface within the rules file
  • Web version of the interface reconstruction

Installation NodeJS

AnyProxy Ali is the father out of a packet capture tool, dependent on NodeJS, the official website https://nodejs.org/en/ download the installation package, download the LTS version on the left, fool installation.

Check the installation of the note, add to environment variable path, so you do not configure the environment variables

Input node -v view the version number after installation

node -v

cnpm installation anyproxy

NPM是随同NodeJS一起安装的包管理工具,能解决NodeJS代码部署上的很多问题,常见的使用场景有以下几种:

  • 允许用户从NPM服务器下载别人编写的第三方包到本地使用。
  • 允许用户从NPM服务器下载并安装别人编写的命令行程序到本地使用。
  • 允许用户将自己编写的包或命令行程序上传到NPM服务器供别人使用。
  • 由于新版的nodejs已经集成了npm,所以之前npm也一并安装好了。可以通过输入 "npm -v"来测试是否成功安装.

npm -v

如果npm版本过低,也可以通过以下指令升级npm版本

npm install npm -g

npm 的包安装分为本地安装(local)、全局安装(global)两种,一般推荐全局安装(-g).

注意,如果直接这样npm安装anyproxy会非常慢

npm install -g anyproxy

由于npm安装很慢,可以用cnpm安装,使用淘宝的镜像地址:http://registry.npm.taobao.org, 这个相当于是npm的升级版,先用npm安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

用cnpm安装anyproxy速度更快

cnpm install -g anyproxy

anyproxy启动

anyproxy安装完成后,在cmd输入anyproxy就能启动服务了

C:\Users\dell>anyproxy
[AnyProxy Log][2019-05-14 23:02:05]: Http proxy started on port 8001
[AnyProxy Log][2019-05-14 23:02:05]: web interface started on port 8002

设置代理端口是8001,web页面打开的端口是8002,打开浏览器输入http://localhost:8002/ (或者http://127.0.0.1:8002)就能打开anyproxy页面了

这个页面打开暂时是抓不到任何请求的,如果想抓到手机app上的请求,继续往下看

电脑安装证书

想抓到https请求,电脑上需安装证书,打开anyproxy web页面->RootCA->Download->rootCA.crt,傻瓜式下一步安装

安装完成后,通过anyproxy -i命令启动监听,即可捕获HTTPS请求

C:\Users\dell>anyproxy -i
[AnyProxy WARN][2019-05-15 00:34:14]: ROOT CA NOT INSTALLED YET
[AnyProxy Log][2019-05-15 00:34:14]: You can install the root CA manually.
[AnyProxy Log][2019-05-15 00:34:14]: The root CA file path is: C:\Users\dell\.anyproxy\certificates\rootCA.crt [AnyProxy Log][2019-05-15 00:34:14]: Http proxy started on port 8001 [AnyProxy Log][2019-05-15 00:34:14]: web interface started on port 8002

电脑启动代理

点开电脑右下角网络设置-开启代理-输入ip和8001监听端口

如果不想抓了,就关闭这个代理设置

手机设置代理

确保手机和电脑是同一局域网, 打开cmd输入ipconfig,查看本机的ipv4地址

手机上设置代理,ip就是自己电脑的ipv4地址,端口是8001

手机安装证书

我们需要在被代理的手机上安装证书,这样在AnyProxy上才能以明文的方式查看https请求内容。在手机上安装证书有两种方式:

直接在手机浏览器中打开http://ip:8002/fetchCrtFile(IP换成安装AnyProxy机器的IP)
在安装AnyProxy主机上打开http://localhost:8002/,RootCA界面然后扫描二维码,在浏览器中打开安装证书

如果下载后的证书无法安装,打开手机wifi界面-右下角更多-高级WLAN设置-安装证书-左上角打开文件夹-找到下载的证书,点击安装

anyproxy抓手机https请求

在手机上打开app操作,就能抓到app上 的请求了

参考这篇博客:https://cloud.tencent.com/developer/article/1086128

  转自:https://www.cnblogs.com/yoyoketang/p/10867050.html

Guess you like

Origin www.cnblogs.com/dreamhighqiu/p/10990051.html