mirror of
https://github.com/httptoolkit/frida-interception-and-unpinning.git
synced 2026-10-21 23:32:43 +02:00
Add IP connectivity test script
This commit is contained in:
@@ -134,6 +134,12 @@ Each script includes detailed documentation on what it does and how it works in
|
||||
|
||||
This is a low-level hook that applies to _all_ network connections. This ensures that all connections are forcibly redirected to the target proxy server, even those which ignore proxy settings or make other raw socket connections.
|
||||
|
||||
* `utilities/test-ip-connectivity.js`
|
||||
|
||||
You probably don't want to use this normally as part of interception itself, but it can be very useful as part of your configuration setup.
|
||||
|
||||
This script allows you to configure a list of possible IP addresses and a target port, and will then send the results of those connectivity tests for each IP:PORT address back to the Frida client, so you can confirm which IP address of a proxy host (e.g. your computer) is reachable from your target device.
|
||||
|
||||
---
|
||||
|
||||
These scripts are part of [a broader HTTP Toolkit project](https://httptoolkit.com/blog/frida-mobile-interception-funding/), funded through the [NGI Zero Entrust Fund](https://nlnet.nl/entrust), established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program. Learn more on the [NLnet project page](https://nlnet.nl/project/F3-AppInterception#ack).
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* This script is a little different from the others, and is designed to help with setup,
|
||||
* particularly in automated scenarios, rather than supporting interception/unpinning/etc.
|
||||
*
|
||||
* Using this script, you can provide a list of IP addresses and a port, and the script will
|
||||
* send messages back to your Frida client for each IP:PORT address that is reachable from
|
||||
* the target device. When your proxy is running on a remote device from the target host,
|
||||
* this can be useful to work out which proxy IP address should be used.
|
||||
*
|
||||
* Source available at https://github.com/httptoolkit/frida-interception-and-unpinning/
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
* SPDX-FileCopyrightText: Tim Perry <tim@httptoolkit.com>
|
||||
*/
|
||||
|
||||
// Modify this to specify the addresses you'd like to test:
|
||||
const IP_ADDRESSES_TO_TEST = [
|
||||
];
|
||||
|
||||
const TARGET_PORT = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// You don't need to modify any of the below - this is the logic that does the
|
||||
// checks themselves.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
if (IP_ADDRESSES_TO_TEST.length === 0) {
|
||||
throw new Error('No IP addresses provided to check - please modify IP_ADDRESSES_TO_TEST');
|
||||
}
|
||||
|
||||
if (TARGET_PORT === 0) {
|
||||
throw new Error('No target port provided to check - please modify TARGET_PORT');
|
||||
}
|
||||
|
||||
async function testAddress(ip, port) {
|
||||
try {
|
||||
const socket = await Socket.connect({ host: ip, port });
|
||||
socket.close();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IP_ADDRESSES_TO_TEST.forEach(async (ip) => {
|
||||
const result = await testAddress(ip, TARGET_PORT);
|
||||
send({
|
||||
type: 'connectivity-result',
|
||||
ip,
|
||||
port: TARGET_PORT,
|
||||
result
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user