-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
221 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/java/com/tb24/blenderumap/FetchFortniteAesKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.tb24.blenderumap; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParser; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.Reader; | ||
import java.util.Map; | ||
|
||
import okhttp3.OkHttpClient; | ||
import okhttp3.Request; | ||
|
||
public class FetchFortniteAesKey { | ||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); | ||
|
||
public static void main(String[] args) { | ||
try { | ||
Reader reader = new OkHttpClient().newCall(new Request.Builder().url("https://benbotfn.tk/api/v1/aes").build()).execute().body().charStream(); | ||
AesResponse response = GSON.fromJson(reader, AesResponse.class); | ||
reader.close(); | ||
File configFile = new File("config.json"); | ||
FileReader fileReader = new FileReader(configFile); | ||
JsonElement configTree = JsonParser.parseReader(fileReader); | ||
fileReader.close(); | ||
JsonArray keys = configTree.getAsJsonObject().getAsJsonArray("EncryptionKeys"); | ||
|
||
while (keys.size() > 0) { | ||
keys.remove(0); | ||
} | ||
|
||
JsonObject mainKey = new JsonObject(); | ||
mainKey.addProperty("Guid", "00000000000000000000000000000000"); | ||
mainKey.addProperty("Key", response.mainKey); | ||
keys.add(mainKey); | ||
|
||
for (Map.Entry<String, String> entry : response.dynamicKeys.entrySet()) { | ||
JsonObject dynKey = new JsonObject(); | ||
dynKey.addProperty("FileName", entry.getKey().substring(entry.getKey().lastIndexOf('/') + 1)); | ||
dynKey.addProperty("Key", entry.getValue()); | ||
keys.add(dynKey); | ||
} | ||
|
||
FileWriter fileWriter = new FileWriter(configFile); | ||
GSON.toJson(configTree, fileWriter); | ||
fileWriter.close(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static class AesResponse { | ||
public String version; | ||
public String mainKey; | ||
public Map<String, String> dynamicKeys; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.