Files
OpenAntiSpoof-Pro/README.md
T

86 lines
6.5 KiB
Markdown

<p align="center">
<br>
<font size="6"><b>OpenAntiSpoof-FullOpsec</b></font>
<br>
<font size="3">by notme_ssa</font>
</p>
---
<p align="center">
<img src="assets/jak.jpg" alt="jak" height="150" />
<img src="assets/hack.jpg" alt="hack" height="150" />
<img src="assets/deobf2.png" alt="deobf2" height="150" />
<img src="assets/deobf.jpg" alt="deobf" height="150" />
</p>
---
## How it works
### 1. Startup & Wiring
- `AntiSpoofPlugin` loads `config.yml` and `brands-and-channels.yml` via `ConfigManager`, initializes per-player storage/logging (`PlayerStorageManager`, `PlayerLogManager`), `SurgeGuardManager`, and exposes the `AntiSpoofAPI` bridge (`ApiLifecycle` + `EventBus`).
- Starts the embedded NanoHTTPD resource-pack server (`ProbeHttpServer`) when `key-spoof-probe`, `identity-linker`, or `asset-probe` is enabled, optionally initializes the Pcap4J TCP/OS sniffer (`OsFingerprintManager`), registers Bukkit + PacketEvents listeners, binds `/antispoof`, and hooks `PlaceholderAPI` when present.
### 2. Player Join & Signal Collection
- **Configuration & Handshake Trace (`BrandChannelListener`)**: intercepts Handshake virtual host, Configuration/Play plugin messages (`minecraft:brand`, `minecraft:register`, client API channels), `CLIENT_SETTINGS` locale, and 1.20.5+ `SELECT_KNOWN_PACKS` (`[ConfigTrace]`).
- **Sign & Anvil Translation/Keybind Probes (`TranslationProbeManager`)**: dispatches 4-line Sign double-probes with randomized canary keys (`key.antispoof.<rand8>`), hex nonces, and vanilla baselines (`fallback: "⟦%3$s|%2$s|%1$s⟧"`), plus auto-closing Anvil `NAME_ITEM` probes (`\t<nonce>`).
- **3-Phase Key-Spoof RP Probe Lab (`KeySpoofRpProbeManager`)**:
- **Phase 1**: 1.20.6 vanilla edge keys (`item.minecraft.mace`) + nested mod `translate`/`keybind` inside `chat.type.text` `with` arguments.
- **Phase 2**: pushes a temporary server resource pack overriding mod keys (`key.meteor-client.open-gui`, `category.meteor-client`) and placing custom keys inside mod namespaces (`assets/meteor-client/lang/`, `assets/opsec/lang/`).
- **Phase 3**: calls `removeResourcePack`, waits 80 ticks (4s) for clean client reload, and verifies cache eviction.
- **Differential Bitmap Font Asset Probe (`AssetProbeListener` & `AssetProbeLabManager`)**:
- Config-driven `TEXTURES`, `FONT`, and `CORRUPTION` resource-pack rules (`asset-probe.rules`) with automatic A/B control pack verification (`FAILED_RELOAD` on guaranteed missing asset vs `SUCCESSFULLY_LOADED` on real mod texture paths like `meteor-client:meteor.png`).
- Works directly through `FontManager` / `ResourceManager`, detecting modded clients even when OpSec Key Spoof is active.
- **Command-Book Verification Probe (`CommandBookProbeManager`)**: declares a synthetic command node (`/asverify_<nonce>`) via `WrapperPlayServerDeclareCommands` and opens a verification Written Book with `ClickEvent(RUN_COMMAND)` to test for client-side command-book blockers.
- **Probe Freeze (`ProbeFreezeManager`)**: optionally freezes movement, block/entity actions, and non-whitelisted commands (`probe-freeze.allowed-commands` regex) until verification probes finish or the safety timeout expires.
- **Discord Webhook Alerts (`DiscordWebhookNotifier`)**: async rate-limited JSON embed webhook notifier (strictly opt-in via `discord.enabled` + `discord.webhook-url`).
- **Additional Subsystems**: `IdentityLinkerManager` (HTTP cache alt-linking), `ResourcePackIntegrityListener` (`ACCEPTED -> SUCCESSFULLY_LOADED < 5ms` timing anomaly check), `ProxyDetectionManager` (RTT delta heuristic), `OsDetectorService` / `OsFingerprintManager` (passive TCP/OS fingerprinting), `ActiveReconScanner`, and `ClientApiHookManager` (Lunar, Badlion, Feather, LabyMod, Bedrock/Geyser).
### 3. Detection Logic
- **Brand, Channel & Virtual Host Checks** (`BrandChannelListener`):
- Flags missing brands (`NO_BRAND`), unknown brands (`UNKNOWN_BRAND`), blocked virtual hosts (`BLOCKED_VIRTUAL_HOST`), blocked channels (`BLOCKED_CHANNEL`), missing required channels (`MISSING_REQUIRED_CHANNELS`), and vanilla-brand + modded-channel mismatches (`VANILLA_WITH_CHANNELS`).
- **Translation, Keybind & Asset Probes** (`TranslationProbeManager`, `KeySpoofRpProbeManager`, `AssetProbeLabManager`, `CommandBookProbeManager`):
- Detects unspoofed mod keys via Sign/Anvil translation & keybind probes, detects spoofed fallback/canary mismatches, detects OpSec-protected clients via Bitmap Font A/B Asset Probe (`ASSET_DETECTED`), and flags blocked verification books (`COMMAND_BOOK_BLOCKED`).
- **Proxy & OS Analysis** (`ProxyDetectionManager`, `OsFingerprintManager`):
- Evaluates ping samples against handshake RTT (`POSSIBLE_PROXY`, `SUSPECTED_PROXY`) and fingerprints client OS via TCP SYN signatures when Pcap4J is enabled.
### 4. Violation, Alert & Punishment Pipeline
```text
AntiSpoofPlugin.flagPlayer(player, violationType, reason)
├─ isBypassed(uuid) || player.hasPermission("antispoof.bypass") -> skip
├─ Record violation on PlayerProfile & increment weighted threat level
├─ PlayerLogManager -> append structured FLAG entry + JSON snapshot
├─ notifyStaff -> broadcast formatted alert to online staff (antispoof.alerts)
├─ DiscordWebhookNotifier -> async rate-limited JSON embed (if discord.enabled)
├─ EventBus -> AntiSpoofAPI dispatches ViolationReportedEvent
└─ If PunishmentRule.isPunish() && !commands.isEmpty():
├─ Dispatch AntiSpoofPrePunishmentEvent (cancellable)
└─ If not cancelled -> execute configured console punishment commands
```
### 5. Commands, GUI & Placeholders
- **Commands** (`AntiSpoofCommand`, 29 subcommands): `/antispoof <gui|alerts|guard|channels|brand|host|os|mods|translate|keybind|keyspoof|assetlab|check|proxy|runcheck|runmods|runbook|stopmods|verify|search|client|logs|listchannels|listbrands|reload|config|help>`.
- **Staff GUI**: `MainMenuGui`, `ConfigGui`, `ClientBrandsGui`, `PlayerListGui`, `PlayerInfoGui`, and `LogSnapshotGui` for live inspection and live config toggling.
- **PlaceholderAPI** (`AntiSpoofPlaceholderExpansion`): `%antispoof_brand%`, `%antispoof_version%`, `%antispoof_locale%`, `%antispoof_os%`, `%antispoof_proxy%`, `%antispoof_threat%`, `%antispoof_mods%`, `%antispoof_channels%`, `%antispoof_bedrock%`, `%antispoof_flagged%`.
---
## How to build
### Prerequisites
- **Java Development Kit**: JDK 21+ (compiled with `--release 21`)
- **Paper / Folia 1.20.6** + **PacketEvents 2.7.0+**
---
### Building OpenAntiSpoof-FullOpsec
Run from this folder:
```powershell
.\gradlew.bat clean build --no-daemon
```
Output JAR: `build/libs/AntiSpoof-1.5.0.jar`