Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. import System;
  2. import System.Web;
  3. import System.Windows.Forms;
  4. import Fiddler;
  5.  
  6. class Handlers
  7. {
  8. static var SquadPlayground = true;
  9. static var RegionOverride = "NAE";
  10.  
  11. static function OnBeforeRequest(oSession: Session) {
  12. // Apparently, Epic updated the OAuth token, so let's change that.
  13. if (oSession.HostnameIs("account-public-service-prod03.ol.epicgames.com")) {
  14. if (oSession.PathAndQuery.Contains("/account/api/oauth/token")) {
  15. oSession.oRequest.headers["Authorization"] = "basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=";
  16. }
  17. }
  18.  
  19. if (oSession.HostnameIs("fortnite-public-service-prod11.ol.epicgames.com")) {
  20. // A fix for profile0 error, etc...
  21. if (oSession.PathAndQuery.Contains("/QueryProfile?profileId=profile0")) {
  22. oSession.url = oSession.url.Replace("profileId=profile0","profileId=athena");
  23. }
  24. else if (oSession.PathAndQuery.StartsWith("/fortnite/api/game/v2/matchmakingservice/ticket/player/")) {
  25. // TODO: Clean up this code
  26. var uriSplit = (oSession.url + "?").split("?");
  27. var queryString = HttpUtility.ParseQueryString(uriSplit[1]);
  28. var bucketSplit = queryString.Get("bucketId").split(":");
  29.  
  30. bucketSplit[2] = RegionOverride; // Set region override
  31.  
  32. // 2 = Solo
  33. // 10 = Duo
  34. // 9 = Squad
  35. switch (bucketSplit[3]) {
  36. case "2": bucketSplit[3] = "playlist_defaultsolo"; break;
  37. case "10": bucketSplit[3] = "playlist_defaultduo"; break;
  38.  
  39. case "9":
  40. if (SquadPlayground) {
  41. bucketSplit[3] = "playlist_playground";
  42. }
  43. else {
  44. bucketSplit[3] = "playlist_defaultsquad";
  45. }
  46. break;
  47.  
  48. default: FiddlerObject.alert("Unknown Match Type (" + bucketSplit[3] + ")"); // Cannot handle this match type
  49. }
  50.  
  51. var bucketString = bucketSplit.join(":");
  52. queryString.Set("bucketId", bucketString);
  53.  
  54. // TODO: Figure out what these are
  55. queryString.Set("party.WIN", "true");
  56. queryString.Set("input.KBM", "true"); // Keyboard & Mouse?
  57.  
  58. oSession.url = uriSplit[0] + "?" + queryString.ToString(); // Hackjob
  59. }
  60. }
  61. }
  62.  
  63. static function OnBeforeResponse(oSession: Session) {
  64. if (oSession.HostnameIs("fortnite-public-service-prod11.ol.epicgames.com")) {
  65. oSession.utilDecodeResponse();
  66.  
  67. // Bypass versioncheck & a few other things
  68. if (oSession.PathAndQuery.StartsWith("/fortnite/api/versioncheck?version=")) {
  69. oSession.oResponse.headers.HTTPResponseCode = 200;
  70. oSession.oResponse.headers.HTTPResponseStatus = "200 OK";
  71.  
  72. oSession.oResponse.headers.Remove("X-Epic-Error-Code");
  73. oSession.oResponse.headers.Remove("X-Epic-Error-Name");
  74.  
  75. oSession.utilSetResponseBody("{\"type\":\"OK\"}");
  76. }
  77. else if (oSession.PathAndQuery.Contains("/RefreshExpeditions") ||
  78. oSession.PathAndQuery.Contains("/IncrementNamedCounterStat") ||
  79. oSession.PathAndQuery.Contains("/GetMcpTimeForLogin")) {
  80.  
  81. oSession.oResponse.headers.HTTPResponseCode = 200;
  82. oSession.oResponse.headers.HTTPResponseStatus = "200 OK";
  83.  
  84. oSession.oResponse.headers.Remove("X-Epic-Error-Code");
  85. oSession.oResponse.headers.Remove("X-Epic-Error-Name");
  86.  
  87. oSession.utilSetResponseBody("{}");
  88. }
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement