Initial commit: OpenFUT Bridge

FIFA 23 reverse-engineering proxy and integration scaffold.

- Catch-all HTTP proxy that captures all incoming FIFA 23 traffic
- Known-route mapper (speculative FUT paths → Core API calls)
- Placeholder JSON responses for unmapped endpoints
- Admin endpoints: GET /_bridge/captures, GET /_bridge/unknown
- Capture persistence to captures/*.json for RE analysis
- 4 unit tests passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-25 15:09:47 -07:00
commit a826e5f7d3
19 changed files with 2897 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
/// Mapping layer: translates known FIFA 23 API paths to OpenFUT Core endpoints.
/// Unknown paths return None and will be recorded for reverse engineering.
#[derive(Debug, Clone)]
pub struct CoreMapping {
pub method: &'static str,
pub core_path: &'static str,
#[allow(dead_code)]
pub notes: &'static str,
}
/// Attempt to map an incoming FIFA 23 request to an OpenFUT Core call.
/// Returns Some(mapping) if the route is known, None otherwise.
pub fn map_to_core(method: &str, path: &str) -> Option<CoreMapping> {
let m = method.to_uppercase();
let p = path.trim_end_matches('/');
// These are speculative mappings based on common FUT API patterns.
// They will be refined as reverse engineering progresses.
let known: &[(&str, &str, CoreMapping)] = &[
// Auth
(
"POST",
"/ut/auth",
CoreMapping {
method: "POST",
core_path: "/auth/local",
notes: "FUT auth → Core local auth",
},
),
(
"GET",
"/ut/game/fut/user/settings",
CoreMapping {
method: "GET",
core_path: "/profile",
notes: "FUT settings → Core profile",
},
),
// Club
(
"GET",
"/ut/game/fut/usermassinfo",
CoreMapping {
method: "GET",
core_path: "/club",
notes: "FUT mass info → Core club",
},
),
// Squad
(
"GET",
"/ut/game/fut/squad/active",
CoreMapping {
method: "GET",
core_path: "/squad",
notes: "FUT active squad → Core squad",
},
),
// Packs
(
"GET",
"/ut/game/fut/store/packdetails",
CoreMapping {
method: "GET",
core_path: "/packs",
notes: "FUT pack store → Core pack list",
},
),
// Transfer market (guessed)
(
"GET",
"/ut/game/fut/transfermarket",
CoreMapping {
method: "GET",
core_path: "/market",
notes: "FUT transfer market → Core NPC market",
},
),
];
for (km, kp, mapping) in known {
if *km == m && *kp == p {
return Some(mapping.clone());
}
}
None
}
/// Return a safe placeholder response for unknown endpoints.
/// This prevents the FIFA 23 client from crashing while we log traffic.
pub fn placeholder_response(method: &str, path: &str) -> serde_json::Value {
tracing::warn!(
"UNKNOWN ENDPOINT: {} {} — returning placeholder",
method,
path
);
serde_json::json!({
"status": "ok",
"openfut_note": "This endpoint has not been mapped yet. Check captures/ for details.",
"method": method,
"path": path,
})
}