Skip to content

Commit

Permalink
FutureRestore GUI — 1.94
Browse files Browse the repository at this point in the history
  • Loading branch information
CoocooFroggy authored Oct 29, 2021
2 parents b187d81 + ccfa42d commit 0d43031
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 202 deletions.
91 changes: 46 additions & 45 deletions src/main/java/FutureRestoreWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,51 +62,51 @@ public static void runFutureRestore(String futureRestoreFilePath, ArrayList<Stri
// Count the number of FDR timeouts
int fdrTimeouts = 0;

String line;
while ((line = reader.readLine()) != null) {
//Parse messages
Pattern progressBarPattern = Pattern.compile("\u001B\\[A\u001B\\[J([0-9]{3})");
HashMap<String, String> parseableMessages = new HashMap<>() {{
//Normal status messages during restore
put("[DOWN] downloading file", "Downloading firmwares.json...");
put("downloading SEP", "Downloading SEP...");
put("downloading SE firmware", "Downloading SE firmware...");
put("downloading Baseband", "Downloading Baseband...");
put("downloading Rose firmware", "Downloading Rose firmware...");
put("Checking BuildIdentity", "Checking BuildIdentity...");
put("downloading Savage", "Downloading Savage...");
put("downloading Veridian DigestMap", "Downloading Veridian DigestMap...");
put("downloading Veridian FirmwareMap", "Downloading Veridian FirmwareMap...");
put("Entering recovery mode", "Entering recovery mode...");
put("Extracting BuildManifest from iPSW", "Extracting BuildManifest from iPSW...");
put("[IMG4TOOL] checking hash for", "Checking hashes...");
put("Extracting filesystem from iPSW", "Extracting filesystem from iPSW...");
put("Sending iBEC", "Sending iBEC...");
put("Sending NORData", "Sending NORData...");
put("Unmounting filesystems", "Unmounting filesystems...");
put("Sending FDR Trust data now", "Sending FDR trust data...");
put("Sending filesystem now", "Sending filesystem...");
put("Verifying restore", "Verifying restore...");
put("Checking filesystems", "Checking filesystems...");
put("Mounting filesystems", "Mounting filesystems...");
put("Flashing firmware", "Flashing firmware...");
put("Requesting FUD data", "Requesting FUD data...");
put("Updating baseband", "Updating Baseband...");
put("Sending SystemImageRootHash now", "Sending SystemImageRootHash...");
put("Waiting for device to disconnect", "Waiting for device to disconnect...");
put("Connecting to FDR", "Connecting to FDR client...");
put("About to send NOR", "About to send NOR data...");
put("Connecting to ASR", "Connecting to ASR...");
final Pattern progressBarPattern = Pattern.compile("\u001B\\[A\u001B\\[J([0-9]{3})");
final HashMap<String, String> parseableMessages = new HashMap<>() {{
//Normal status messages during restore
put("[DOWN] downloading file", "Downloading firmwares.json...");
put("downloading SEP", "Downloading SEP...");
put("downloading SE firmware", "Downloading SE firmware...");
put("downloading Baseband", "Downloading Baseband...");
put("downloading Rose firmware", "Downloading Rose firmware...");
put("Checking BuildIdentity", "Checking BuildIdentity...");
put("downloading Savage", "Downloading Savage...");
put("downloading Veridian DigestMap", "Downloading Veridian DigestMap...");
put("downloading Veridian FirmwareMap", "Downloading Veridian FirmwareMap...");
put("Entering recovery mode", "Entering recovery mode...");
put("Extracting BuildManifest from iPSW", "Extracting BuildManifest from iPSW...");
put("[IMG4TOOL] checking hash for", "Checking hashes...");
put("Extracting filesystem from iPSW", "Extracting filesystem from iPSW...");
put("Sending iBEC", "Sending iBEC...");
put("Sending NORData", "Sending NORData...");
put("Unmounting filesystems", "Unmounting filesystems...");
put("Sending FDR Trust data now", "Sending FDR trust data...");
put("Sending filesystem now", "Sending filesystem...");
put("Verifying restore", "Verifying restore...");
put("Checking filesystems", "Checking filesystems...");
put("Mounting filesystems", "Mounting filesystems...");
put("Flashing firmware", "Flashing firmware...");
put("Requesting FUD data", "Requesting FUD data...");
put("Updating baseband", "Updating Baseband...");
put("Sending SystemImageRootHash now", "Sending SystemImageRootHash...");
put("Waiting for device to disconnect", "Waiting for device to disconnect...");
put("Connecting to FDR", "Connecting to FDR client...");
put("About to send NOR", "About to send NOR data...");
put("Connecting to ASR", "Connecting to ASR...");
// put("waiting for message", "Waiting for message from FDR...");

//Special messages
put("Status: Restore Finished", "Restore Finished!");
put("what=", null);
put("code=", null);
put("unknown option -- use-pwndfu", null);
put("timeout waiting for command", null);
}};
//Special messages
put("Status: Restore Finished", "Restore Finished!");
put("what=", null);
put("code=", null);
put("unknown option -- use-pwndfu", null);
put("timeout waiting for command", null);
}};

String line;
while ((line = reader.readLine()) != null) {
// Parse messages
for (Map.Entry<String, String> entrySet : parseableMessages.entrySet()) {
String futureRestorePossibleMatch = entrySet.getKey();
String fancyLog = entrySet.getValue();
Expand Down Expand Up @@ -170,7 +170,6 @@ public static void runFutureRestore(String futureRestoreFilePath, ArrayList<Stri
if (!openWebpageResult)
appendToLog(logTextArea, writer, "Unable to open URL in your web browser. URL copied to clipboard, please open it manually.");
}

break;
}
}
Expand Down Expand Up @@ -205,18 +204,20 @@ public static void runFutureRestore(String futureRestoreFilePath, ArrayList<Stri
}
}
}
break;
}
}

//If it is a progress bar
// If it is a progress bar
if (line.contains("[A")) {
Matcher progressBarMatcher = progressBarPattern.matcher(line);
if (progressBarMatcher.find()) {
//Set progress bar to parsed value
logProgressBar.setValue(Integer.parseInt(progressBarMatcher.group(1)));
}
} else {
logProgressBar.setValue(0);
if (logProgressBar.getValue() != 0)
logProgressBar.setValue(0);
appendToLog(logTextArea, writer, line);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
public class Main {
public static void main(String[] args) {
MainMenu.futureRestoreGUIVersion = "1.93";
MainMenu.futureRestoreGUIVersion = "1.94";
MainMenu.main();
/*
Expand Down
Loading

0 comments on commit 0d43031

Please sign in to comment.