无法使用http-mitm-proxy捕获iPhone上的网络流量

问题描述 投票:0回答:1

我正在尝试使用以下方法捕获 iPhone 应用程序的网络流量(使用 WebdriverIO 测试框架) https://www.npmjs.com/package/http-mitm-proxy但它不适合我。

import {Proxy} from "http-mitm-proxy";

describe('Calculate perf data', () => {
it('Calculate perf data', async () => 
{
    const proxy = new Proxy();
    proxy.onError((ctx, err) => {
        console.error('Proxy error:', err);
    });

    proxy.onRequest((ctx, callback) => {
        console.log('Proxy request:', ctx.clientToProxyRequest.headers.host, ctx.clientToProxyRequest.url);
        ctx.use(Proxy.gunzip);

        ctx.onResponseData((ctx, chunk, callback) => {
            console.log('Response data:', chunk.toString());
            return callback(null, chunk);
        });

        return callback();
    });

    proxy.listen({port: 8081}, () => {
        console.log('Proxy server is listening on port 8081');
    });

    console.log('begin listening on 8081')

    const email = "///XCUIElementTypeTextField";
    const pwd = "//XCUIElementTypeSecureTextField[@name=\"text-input-outlined\"]";

    const login = "//XCUIElementTypeButton[@name=\"button\"]";
    (await $(email).setValue("[email protected]"));
    (await $(pwd).setValue("xyz"));
    (await $(login).click());

})
})

已在iPhone上安装代理证书并尝试设置wifi代理设置(服务器地址:mac ip,端口:8081)但没有成功

webdriver-io mitmproxy node-mitm
1个回答
0
投票

确保您安装了正确的证书,否则它将无法工作(阅读有关 ssl 的部分)。您还可以查看 mitmproxy.org 作为替代方案。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.