SniffMaster Interceptor User Guide

SniffMaster allows you to intercept and modify network requests and responses, including their full content, such as request URL, headers, and body. By writing JavaScript, you can make modifications, replacements, and set rules for requests.

Open Interceptor Log

On the right side of the proxy packet capture interface, there is an interceptor icon resembling a plug. Double-click the interceptor icon to open the interceptor log interface, where you can view the status and, if the interceptor is enabled, see the interception logs.

sniffmaster plugin

Open Interceptor Editor

In the interceptor log interface, click Edit Interceptor to access the interceptor editing functionality.

alt text

Edit Interceptor Code

The interceptor includes a default code example demonstrating the basic framework. You need to modify this according to your specific needs. The interceptor code is written in JavaScript, and the names of the three functions and their parameters cannot be changed; only the internal logic of the functions can be modified.

The interceptor must at least contain the following code, which is an empty interceptor that does nothing.

 1function handleRequest(request) {
 2    return request;
 3}
 4
 5function handleResponse(response) {
 6    return response;
 7}
 8
 9function filterUrl() {
10    return [];
11}

A simple interceptor example is shown below. This interceptor intercepts Google requests and logs messages when sending or receiving data.

function handleRequest(request) {
    console.log("Preparing to send request to " + request.URL);
    return request;
}

function handleResponse(response) {
    console.log("Received response from " + response.URL);
    return response;
}

function filterUrl() {
    return ["https://www.google.com/*"];
}

Interceptor - request Object

The request object contains all the data of the request about to be sent to the server. You can modify this data to alter what is sent to the server. The request object includes the following properties:

Interceptor - response Object

The response object contains all the information returned by the server. You can modify this to alter the data sent to the final target program. The response object has similar properties to the request object, with the addition of the StatusCode field: