From 725fcf78432f7ea992bacab46bde2e41dbb8e199 Mon Sep 17 00:00:00 2001 From: airsquared <36649395+airsquared@users.noreply.github.com> Date: Sun, 24 Mar 2019 11:17:51 -0700 Subject: [PATCH] Fix reading tsschecker output, update tsschecker executable if already in .blobsaver_bin --- .../java/com/airsquared/blobsaver/Shared.java | 2 +- .../com/airsquared/blobsaver/TSSChecker.java | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/airsquared/blobsaver/Shared.java b/src/main/java/com/airsquared/blobsaver/Shared.java index 525e03e8..a48dbda3 100644 --- a/src/main/java/com/airsquared/blobsaver/Shared.java +++ b/src/main/java/com/airsquared/blobsaver/Shared.java @@ -163,7 +163,7 @@ static String makeRequest(URL url) throws IOException { static File getTsschecker() throws IOException { File executablesFolder = getExecutablesFolder(); File tsschecker = new File(executablesFolder, "tsschecker"); - if (tsschecker.exists() && appPrefs.getBoolean("tsschecker last update v2.2.3", false)) { + if (tsschecker.exists() && appPrefs.getBoolean("tsschecker last update v2.3.1", false)) { return tsschecker; } else { if (tsschecker.exists()) { diff --git a/src/main/java/com/airsquared/blobsaver/TSSChecker.java b/src/main/java/com/airsquared/blobsaver/TSSChecker.java index 3268ed91..b550343f 100644 --- a/src/main/java/com/airsquared/blobsaver/TSSChecker.java +++ b/src/main/java/com/airsquared/blobsaver/TSSChecker.java @@ -150,6 +150,7 @@ private static void run(String device, String version) { try { System.out.println("Running: " + args.toString()); tsscheckerLog = executeProgram(args.toArray(new String[0])); + System.out.println(tsscheckerLog); } catch (IOException e) { newReportableError("There was an error starting tsschecker.", e.toString()); e.printStackTrace(); @@ -157,7 +158,7 @@ private static void run(String device, String version) { return; } - if (tsscheckerLog.contains("Saved shsh blobs")) { + if (containsIgnoreCase(tsscheckerLog, "Saved signing tickets")) { // if multiple versions are being saved at the same time, do not show success message multiple times // the success message will be shown after saving everything is completed if (!controller.versionCheckBox.isSelected()) { @@ -167,43 +168,43 @@ private static void run(String device, String version) { } deleteTempFiles(buildManifestPlist); return; - } else if (tsscheckerLog.contains("[Error] [TSSC] manually specified ecid=" + ecid + ", but parsing failed")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] manually specified ecid=" + ecid + ", but parsing failed")) { newUnreportableError("\"" + ecid + "\"" + " is not a valid ECID. Try getting it from iTunes.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again."); controller.ecidField.setEffect(errorBorder); - } else if (tsscheckerLog.contains("[Error] [TSSC] device " + device + " could not be found in devicelist")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] device " + device + " could not be found in devicelist")) { Alert alert = new Alert(Alert.AlertType.ERROR, "tsschecker could not find device: \"" + device + "\"\n\nPlease create a new Github issue or PM me on Reddit if you used the dropdown menu.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", githubIssue, redditPM, ButtonType.CANCEL); resizeAlertButtons(alert); alert.showAndWait(); reportError(alert); - } else if (tsscheckerLog.contains("[Error] [TSSC] ERROR: could not get url for device " + device + " on iOS " + version)) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] ERROR: could not get url for device " + device + " on iOS " + version)) { newUnreportableError("Could not find device \"" + device + "\" on iOS/tvOS " + version + "\n\nThe version doesn't exist or isn't compatible with the device"); controller.versionField.setEffect(errorBorder); - } else if (tsscheckerLog.contains("[Error] [TSSC] manually specified apnonce=" + apnonce + ", but parsing failed")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] manually specified apnonce=" + apnonce + ", but parsing failed")) { newUnreportableError("\"" + apnonce + "\" is not a valid apnonce"); controller.apnonceField.setEffect(errorBorder); - } else if (tsscheckerLog.contains("[WARNING] [TSSC] could not get id0 for installType=Erase. Using fallback installType=Update since user did not specify installType manually") - && tsscheckerLog.contains("[Error] [TSSR] Error: could not get id0 for installType=Update") - && tsscheckerLog.contains("[Error] [TSSR] faild to build tssrequest") - && tsscheckerLog.contains("Error] [TSSC] checking tss status failed!")) { + } else if (containsIgnoreCase(tsscheckerLog, "[WARNING] [TSSC] could not get id0 for installType=Erase. Using fallback installType=Update since user did not specify installType manually") + && containsIgnoreCase(tsscheckerLog, "[Error] [TSSR] Error: could not get id0 for installType=Update") + && containsIgnoreCase(tsscheckerLog, "[Error] [TSSR] faild to build TSS request") + && containsIgnoreCase(tsscheckerLog, "Error] [TSSC] checking tss status failed!")) { Alert alert = new Alert(Alert.AlertType.ERROR, "Saving blobs failed. Check the board configuration or try again later.\n\nIf this doesn't work, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", githubIssue, redditPM, ButtonType.OK); resizeAlertButtons(alert); alert.showAndWait(); reportError(alert, tsscheckerLog); - } else if (tsscheckerLog.contains("[Error] ERROR: TSS request failed: Could not resolve host:")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] ERROR: TSS request failed: Could not resolve host:")) { Alert alert = new Alert(Alert.AlertType.ERROR, "Saving blobs failed. Check your internet connection.\n\nIf your internet is working and you can connect to apple.com in your browser, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", githubIssue, redditPM, ButtonType.OK); resizeAlertButtons(alert); alert.showAndWait(); reportError(alert, tsscheckerLog); - } else if (tsscheckerLog.contains("[Error] [Error] can't save shsh at " + savePath)) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [Error] can't save signing tickets at " + savePath)) { newUnreportableError("\'" + savePath + "\' is not a valid path\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again."); controller.pathField.setEffect(errorBorder); - } else if (tsscheckerLog.contains("iOS " + version + " for device " + device + " IS NOT being signed!") || tsscheckerLog.contains("Build " + controller.buildIDField.getText() + " for device" + device + "IS NOT being signed!")) { + } else if (containsIgnoreCase(tsscheckerLog, "iOS " + version + " for device " + device + " IS NOT being signed!") || tsscheckerLog.contains("Build " + controller.buildIDField.getText() + " for device" + device + "IS NOT being signed!")) { newUnreportableError("iOS/tvOS " + version + " is not being signed for device " + device); if (version.equals(controller.versionField.getText())) { controller.versionField.setEffect(errorBorder); @@ -212,16 +213,16 @@ private static void run(String device, String version) { controller.buildIDField.setEffect(errorBorder); controller.ipswField.setEffect(errorBorder); } - } else if (tsscheckerLog.contains("[Error] [TSSC] failed to load manifest")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] failed to load manifest")) { Alert alert = new Alert(Alert.AlertType.ERROR, "Failed to load manifest.\n\n \"" + ipswURL + "\" might not be a valid URL.\n\nMake sure it starts with \"http://\" or \"https://\", has \"apple\" in it, and ends with \".ipsw\"\n\nIf the URL is fine, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard", githubIssue, redditPM, ButtonType.OK); resizeAlertButtons(alert); alert.showAndWait(); reportError(alert, tsscheckerLog); - } else if (tsscheckerLog.contains("[Error] [TSSC] selected device can't be used with that buildmanifest")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] selected device can't be used with that buildmanifest")) { newUnreportableError("Device and build manifest don't match."); - } else if (tsscheckerLog.contains("[Error]")) { + } else if (containsIgnoreCase(tsscheckerLog, "[Error]")) { newReportableError("Saving blobs failed.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", tsscheckerLog); } else { newReportableError("Unknown result.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", tsscheckerLog);