An open API service indexing awesome lists of open source software.

https://github.com/daijro/hazetunnel

🔮 Vindicate non-organic web traffic via MITM proxy
https://github.com/daijro/hazetunnel

golang injector mitm networking playwright proxy tls

Last synced: 3 months ago
JSON representation

🔮 Vindicate non-organic web traffic via MITM proxy

Awesome Lists containing this project

README

        


Hazetunnel


🔮 Vindicate non-organic web traffic

---

Hazetunnel is an MITM proxy that attempts to legitimize [BrowserForge](https://github.com/daijro/browserforge/)'s injected-browser web traffic by hijacking the TLS fingerprint to mirror the passed User-Agent.

Additionally, it can inject a Javascript payload into the web page to defend against [worker fingerprinting](https://github.com/apify/fingerprint-suite/issues/64).


### Features ✨

- Anti TLS fingerprinting 🪪

- Emulate the ClientHello of browsers based on the passed User-Agent (e.g. Chrome/120)
- Bypasses TLS fingerprinting checks

- Javascript payload injection 💉

- Prepends payload to all Javascript responses, including the web page Service/Shared worker scope.
- Injects payload into embedded base64 encoded JavaScript within HTML responses ([see here](https://github.com/apify/fingerprint-suite/issues/64#issuecomment-1282877696))

This project was built on [tlsproxy](https://github.com/rosahaj/tlsproxy), please leave them a star!

---

# Usage

This package can be installed and used through Python. It is avaliable on PyPi:

```bash
pip install hazetunnel
```

You can also use it as a standalone Go executable by building the tool with the [guide](https://github.com/daijro/hazetunnel?tab=readme-ov-file#building) below.

## CLI Usage

After installing Hazetunnel through PyPi, it can be used as a standalone CLI application.

This example will inject `alert('Hello world');` before all Javascript responses:

```bash
hazetunnel run --payload "alert('Hello world');" --port 8080
```


CLI parameters

```
$ hazetunnel run --help
Usage: hazetunnel run [OPTIONS]

Run the MITM proxy

Options:
-p, --port TEXT Port to use. Default: 8080.
--user_agent TEXT Override User-Agent headers.
--payload TEXT Payload to inject into responses.
--upstream_proxy TEXT Forward requests to an upstream proxy.
--cert TEXT Path to the certificate file.
--key TEXT Path to the key file.
-v, --verbose Enable verbose output.
--help Show this message and exit.
```

More info on other CLI commands are avaliable [here](https://github.com/daijro/hazetunnel/tree/main/python-bindings#python-usage).

### Payload Injection

#### Javascript responses

This [example server](https://github.com/daijro/hazetunnel/blob/main/example/server.py) will return `console.log('Original JavaScript executed.')` when called:

**Original response:**

```bash
$ curl http://localhost:5000/js
console.log('Original JavaScript executed.');
```

**With Hazetunnel:**

```bash
$ curl http://localhost:5000/js --proxy http://localhost:8080 --cacert cert.pem
alert('Hello world');console.log('Original JavaScript executed.');
```

#### HTML responses

Additionally, Hazetunnel can inject payloads into HTML responses:

```bash
$ curl http://localhost:5000/html --proxy http://localhost:8080 --cacert cert.pem

Base64 JavaScript Testing Page


This page includes an embedded base64 encoded JavaScript for testing.