Metadata-Version: 2.4
Name: shadowfire
Version: 1.0.0
Summary: ShadowFire - Free Fire optimized MITM proxy (fork of mitmproxy).
Author: 1nOnlySahil
License: Copyright (c) 2013, Aldo Cortesi. All rights reserved.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/1nOnlySahil/shadowfire
Project-URL: Source, https://github.com/1nOnlySahil/shadowfire/
Project-URL: Issues, https://github.com/1nOnlySahil/shadowfire/issues
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console :: Curses
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Security
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: System :: Networking :: Monitoring
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aioquic<=1.2.0,>=1.2.0
Requires-Dist: argon2-cffi<=25.1.0,>=23.1.0
Requires-Dist: asgiref<=3.11.1,>=3.2.10
Requires-Dist: bcrypt<=5.0.0,>=5.0.0
Requires-Dist: Brotli<=1.2.0,>=1.0
Requires-Dist: certifi>=2019.9.11
Requires-Dist: cryptography<=49.0.0,>=42.0
Requires-Dist: flask<=3.1.3,>=3.0
Requires-Dist: h11<=0.16.0,>=0.16.0
Requires-Dist: h2<=4.3.0,>=4.3.0
Requires-Dist: hyperframe<=6.1.0,>=6.0
Requires-Dist: kaitaistruct<=0.11,>=0.10
Requires-Dist: ldap3<=2.9.1,>=2.8
Requires-Dist: mitmproxy_rs<0.13,>=0.12.6
Requires-Dist: msgpack<=1.1.2,>=1.0.0
Requires-Dist: pydivert<=3.1.1,>=2.0.3; sys_platform == "win32"
Requires-Dist: pyOpenSSL<=27.0.0,>=24.3
Requires-Dist: pyparsing<=3.3.2,>=2.4.2
Requires-Dist: pyperclip<=1.11.0,>=1.9.0
Requires-Dist: ruamel.yaml<=0.19.1,>=0.18.10
Requires-Dist: sortedcontainers<=2.4.0,>=2.3
Requires-Dist: tornado<=6.5.5,>=6.5.0
Requires-Dist: typing-extensions<=4.14,>=4.13.2; python_version < "3.13"
Requires-Dist: urwid<=4.0.0,>=2.6.14
Requires-Dist: wsproto<=1.3.2,>=1.0
Requires-Dist: publicsuffix2<=2.20191221,>=2.20190812
Requires-Dist: zstandard<=0.25.0,>=0.25
Dynamic: license-file

# ShadowFire

A Free Fire-optimized MITM proxy, forked from mitmproxy. ShadowFire combines a full-featured HTTPS interception proxy with a dedicated Free Fire bypass pipeline.

## Features

### Core Proxy (forked from mitmproxy)
- Interactive console UI, headless dump mode, and web UI
- HTTP/1, HTTP/2, HTTP/3, and WebSocket interception
- TLS interception with dynamic certificate generation
- TCP, UDP, and DNS proxy modes
- Scriptable via Python addons
- Full mitmproxy addon ecosystem compatibility

### Free Fire Bypass Addon
- **Login interception** — hooks into Free Fire API domains (`loginbp.ggblueshark.com`, `prod-api.reward.ff.garena.com`, etc.)
- **UID blocking** — inspect raw TCP streams and block connections by UID
- **Fingerprint masking** — strips proxy-detection headers (`Via`, `X-Forwarded-For`, etc.) and rewrites User-Agent
- **JWT forwarding** — integrates with the access_jwt token mutation service
- **Runtime commands** — `ff.block_uid`, `ff.unblock_uid`, `ff.list_blocked`

### Backend Pipeline
- Raw TCP forwarder on `:9999` — bidirectional byte-level proxy with game-layer AES decrypt
- JWT mutation service on `:1080` — template-based protobuf payload rewriting
- Admin HTTP API on `:5000` — UID management, stats, health checks
- UID sync loop — pulls blocklists from remote API every 120s

## Architecture

```
Emulator → Raw Forwarder (:9999) → ShadowFire Proxy (:8080) → Game Servers
                                         ↕
                              access_jwt Service (:1080)
                                    (JWT mutation)
```

## Quick Start

```bash
# Install
pip install shadowfire

# Start the proxy
shadowfire

# Start the web UI
shadowfire web

# Start headless dump mode
shadowfire dump
```

### Free Fire Pipeline

```bash
# Terminal 1: Start the backend services
cd new/python
pip install -r requirements.txt
python main.py

# Terminal 2: Start ShadowFire with the bypass addon
shadowfire -s shadowfire/addons/firebypass.py --set ff_bypass=true
```

Configure your emulator to use the proxy at the host machine's LAN IP on port 8080, and the raw forwarder on port 9999.

## Configuration

ShadowFire reads `~/.shadowfire/config.yaml` on startup. Key options:

| Option | Default | Description |
|---|---|---|
| `listen_port` | 8080 | Proxy listen port |
| `mode` | regular | Proxy mode (regular, transparent, socks5, reverse, upstream) |
| `ssl_insecure` | false | Disable upstream TLS verification |
| `ff_bypass` | true | Enable Free Fire bypass addon |
| `ff_blocked_uids` | [] | UIDs to block |
| `ff_access_jwt_url` | http://127.0.0.1:1080 | JWT mutation service URL |
| `ff_mask_fingerprint` | true | Strip proxy fingerprints |

## Building

### PyInstaller (standalone binary)

```bash
pyinstaller release/specs/standalone.spec --clean
# Output: release/dist/shadowfire.exe
```

### MSIX Installer (Windows Store)

```bash
pyinstaller release/specs/onedir.spec --clean
python release/build.py msix-installer
```

### InstallBuilder Installer (Windows)

```bash
pyinstaller release/specs/onedir.spec --clean
python release/build.py installbuilder-installer
```

### Docker

```bash
docker build -t shadowfire release/docker/
docker run -p 8080:8080 -p 8081:8081 shadowfire
```

## Development

```bash
# Install with uv
uv sync

# Run tests
uv run pytest

# Run linter
uv run ruff check shadowfire/

# Type check
uv run mypy shadowfire/
```

## Project Structure

```
shadowfire/                  # Main proxy package
├── addons/                  # Addon modules
│   ├── firebypass.py        # Free Fire bypass addon
│   └── onboardingapp/       # Certificate installation portal
├── proxy/                   # Proxy core
├── tools/                   # CLI entry points
│   ├── main.py              # shadowfire_cli dispatcher
│   ├── console/             # Console UI (curses)
│   ├── dump/                # Headless dump mode
│   └── web/                 # Web UI (React SPA)
├── net/                     # Network protocols
├── io/                      # I/O and serialization
├── contentviews/            # Content decoders
└── utils/                   # Utilities
web/                         # React/TypeScript web UI frontend
release/                     # Build & installer configs
new/python/                  # Free Fire backend pipeline
├── main.py                  # Orchestrator (forwarder, API, UID sync)
└── access_jwt/              # JWT mutation service
```

## License

MIT — see [LICENSE](./LICENSE).

## Credits

ShadowFire is a fork of [mitmproxy](https://github.com/mitmproxy/mitmproxy). The original project is maintained by the mitmproxy contributors and licensed under the MIT license.
