0% found this document useful (0 votes)
156 views

Epic Script

This document contains code for a Handlers class in C# that intercepts requests and responses made by the Fortnite game client to Epic Games servers. It modifies requests by overriding the user's region, fixes errors related to user profiles and matchmaking, and bypasses version checks and other API calls to prevent errors. The code intercepts requests using Fiddler and modifies headers, URLs, and response bodies to manipulate the communication between the game client and Epic's servers.

Uploaded by

Vloger Lariok
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views

Epic Script

This document contains code for a Handlers class in C# that intercepts requests and responses made by the Fortnite game client to Epic Games servers. It modifies requests by overriding the user's region, fixes errors related to user profiles and matchmaking, and bypasses version checks and other API calls to prevent errors. The code intercepts requests using Fiddler and modifies headers, URLs, and response bodies to manipulate the communication between the game client and Epic's servers.

Uploaded by

Vloger Lariok
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import System;

import System.Web;
import System.Windows.Forms;
import Fiddler;

class Handlers
{
static var SquadPlayground = true;
static var RegionOverride = "NAE";

static function OnBeforeRequest(oSession: Session) {


// Apparently, Epic updated the OAuth token, so let's change that.
if (oSession.HostnameIs("account-public-service-prod03.ol.epicgames.com"))
{
if (oSession.PathAndQuery.Contains("/account/api/oauth/token")) {
oSession.oRequest.headers["Authorization"] = "basic
MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I
0MWE=";
}
}

if (oSession.HostnameIs("fortnite-public-service-prod11.ol.epicgames.com"))
{
// A fix for profile0 error, etc...
if (oSession.PathAndQuery.Contains("/QueryProfile?profileId=profile0"))
{
oSession.url =
oSession.url.Replace("profileId=profile0","profileId=athena");
}
else if
(oSession.PathAndQuery.StartsWith("/fortnite/api/game/v2/matchmakingservice/ticket/
player/")) {
// TODO: Clean up this code
var uriSplit = (oSession.url + "?").split("?");
var queryString = HttpUtility.ParseQueryString(uriSplit[1]);
var bucketSplit = queryString.Get("bucketId").split(":");

bucketSplit[2] = RegionOverride; // Set region override

// 2 = Solo
// 10 = Duo
// 9 = Squad
switch (bucketSplit[3]) {
case "2": bucketSplit[3] = "playlist_defaultsolo"; break;
case "10": bucketSplit[3] = "playlist_defaultduo"; break;

case "9":
if (SquadPlayground) {
bucketSplit[3] = "playlist_playground";
}
else {
bucketSplit[3] = "playlist_defaultsquad";
}
break;

default: FiddlerObject.alert("Unknown Match Type (" +


bucketSplit[3] + ")"); // Cannot handle this match type
}
var bucketString = bucketSplit.join(":");
queryString.Set("bucketId", bucketString);

// TODO: Figure out what these are


queryString.Set("party.WIN", "true");
queryString.Set("input.KBM", "true"); // Keyboard & Mouse?

oSession.url = uriSplit[0] + "?" + queryString.ToString(); //


Hackjob
}
}
}

static function OnBeforeResponse(oSession: Session) {


if (oSession.HostnameIs("fortnite-public-service-prod11.ol.epicgames.com"))
{
oSession.utilDecodeResponse();

// Bypass versioncheck & a few other things


if (oSession.PathAndQuery.StartsWith("/fortnite/api/versioncheck?
version=")) {
oSession.oResponse.headers.HTTPResponseCode = 200;
oSession.oResponse.headers.HTTPResponseStatus = "200 OK";

oSession.oResponse.headers.Remove("X-Epic-Error-Code");
oSession.oResponse.headers.Remove("X-Epic-Error-Name");

oSession.utilSetResponseBody("{\"type\":\"OK\"}");
}
else if (oSession.PathAndQuery.Contains("/RefreshExpeditions")
||
oSession.PathAndQuery.Contains("/IncrementNamedCounterStat") ||
oSession.PathAndQuery.Contains("/GetMcpTimeForLogin")) {

oSession.oResponse.headers.HTTPResponseCode = 200;
oSession.oResponse.headers.HTTPResponseStatus = "200 OK";

oSession.oResponse.headers.Remove("X-Epic-Error-Code");
oSession.oResponse.headers.Remove("X-Epic-Error-Name");

oSession.utilSetResponseBody("{}");
}
}
}
}

You might also like