From 8009c03310fbcbf95bd1ac8e10934fba0c098dbe Mon Sep 17 00:00:00 2001 From: Alyx Ferrari Date: Wed, 5 Aug 2020 14:33:52 -0400 Subject: [PATCH] iOS-RR v1.0 beta 3 --- entitlements.xml | 12 ++++ src/com/alyxferrari/iosrr/Display.java | 13 ++-- src/com/alyxferrari/iosrr/RRConst.java | 2 +- .../iosrr/RestrictionsRecovery.java | 1 + updateEntitlements.sh | 64 +++++++++++++++++++ 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 entitlements.xml create mode 100644 updateEntitlements.sh diff --git a/entitlements.xml b/entitlements.xml new file mode 100644 index 0000000..6e2079e --- /dev/null +++ b/entitlements.xml @@ -0,0 +1,12 @@ + + + + + keychain-access-groups + + * + + platform-application + com.apple.private.security.no-container + + diff --git a/src/com/alyxferrari/iosrr/Display.java b/src/com/alyxferrari/iosrr/Display.java index fe770c7..a6de21f 100644 --- a/src/com/alyxferrari/iosrr/Display.java +++ b/src/com/alyxferrari/iosrr/Display.java @@ -102,7 +102,8 @@ public void run() { Display.FRAME.getContentPane().removeAll(); String keychain = null; try { - String ip = JOptionPane.showInputDialog("Device IP address? OpenSSH and SQLite 3.x must be installed on your device."); + JOptionPane.showMessageDialog(null, "Make sure your device meets the following conditions before proceeding:\nYour device must be jailbroken\nYour device must have an SSH server running\nYour device must have the \"SQLite 3.x\" package installed\nYour device is highly recommended to have a passcode (it may work without, but having one fixes a lot of issues)\nMake sure your device is unlocked and on the home screen throughout the whole process"); + String ip = JOptionPane.showInputDialog("Device IP address?"); String portStr = JOptionPane.showInputDialog("Device SSH server port? (press enter to default to 22)"); int port = 22; if (!portStr.equals("")) { @@ -186,7 +187,7 @@ public void run() { ssh2.authPassword("root", rootPass); Session session2 = ssh2.startSession(); JOptionPane.showMessageDialog(null, "Please make sure your device is unlocked and on the home screen."); - Display.FRAME.getContentPane().add(new JLabel("Dumping your device's Keychain... (if this blocks, make sure your device is unlocked)")); + Display.FRAME.getContentPane().add(new JLabel("Dumping your device's Keychain... (authenticate with Touch ID/Face ID if asked)")); System.out.println("Dumping your device's Keychain... (if this blocks, make sure your device is unlocked)"); Display.refresh(); Session.Command cmd = session2.exec("./../mobile/Documents/keychain_dumper"); @@ -195,7 +196,7 @@ public void run() { Display.FRAME.getContentPane().add(new JLabel("Removing keychain_dumper from device...")); System.out.println("Removing keychain_dumper from device..."); Display.refresh(); - session2.exec("rm ./../mobile/Documents/keychain_dumper"); + session2.exec("rm ../mobile/Documents/keychain_dumper"); Display.FRAME.getContentPane().add(new JLabel("Disconnecting...")); System.out.println("Disconnecting..."); Display.refresh(); @@ -206,9 +207,9 @@ public void run() { Display.refresh(); String[] list = keychain.split("ParentalControls")[1].split("\n"); String password = null; - for (int i = 0; i < 20; i++) { - if (list[i].startsWith("Keychain Data: ")) { - password = list[i].split(": ")[1]; + for (int i = 0; i < (list.length > 1000 ? 1000 : list.length); i++) { + if (list[i].contains("Keychain Data: ")) { + password = list[i].split("Keychain Data: ")[1]; break; } } diff --git a/src/com/alyxferrari/iosrr/RRConst.java b/src/com/alyxferrari/iosrr/RRConst.java index 8cafde1..8229b5a 100644 --- a/src/com/alyxferrari/iosrr/RRConst.java +++ b/src/com/alyxferrari/iosrr/RRConst.java @@ -2,7 +2,7 @@ public class RRConst { private RRConst() {} public static final String NAME = "iOS-Restrictions-Recovery"; - public static final String VERSION = "v1.0 beta 1"; + public static final String VERSION = "v1.0 beta 3"; public static final String AUTHOR = "Alyx Ferrari"; public static final String FULL_NAME = NAME + " " + VERSION; public static final String TITLE = "" + FULL_NAME + ""; diff --git a/src/com/alyxferrari/iosrr/RestrictionsRecovery.java b/src/com/alyxferrari/iosrr/RestrictionsRecovery.java index 6f053d3..cec5b48 100644 --- a/src/com/alyxferrari/iosrr/RestrictionsRecovery.java +++ b/src/com/alyxferrari/iosrr/RestrictionsRecovery.java @@ -9,6 +9,7 @@ public class RestrictionsRecovery { private RestrictionsRecovery() {} public static void main(String[] args) throws Exception { + System.setErr(System.out); if (args.length == 0) { Display.createDisplay(); } else { diff --git a/updateEntitlements.sh b/updateEntitlements.sh new file mode 100644 index 0000000..2ce6532 --- /dev/null +++ b/updateEntitlements.sh @@ -0,0 +1,64 @@ +#!/bin/bash +#Original keychain_dumper by Patrick Toomey +#Scrpt by @ReverseThatApp and @vocaeq + +KEYCHAIN_DUMPER_FOLDER=/usr/bin +if [ ! -d "$KEYCHAIN_DUMPER_FOLDER" ] ; then + mkdir "$KEYCHAIN_DUMPER_FOLDER" ; +fi + +# set -e ; + +ENTITLEMENT_PATH=$KEYCHAIN_DUMPER_FOLDER/ent.xml +dbKeychainArray=() +declare -a invalidKeychainArray=("com.apple.bluetooth" + "com.apple.cfnetwork" + "com.apple.cloudd" + "com.apple.continuity.encryption" + "com.apple.continuity.unlock" + "com.apple.icloud.searchpartyd" + "com.apple.ind" + "com.apple.mobilesafari" + "com.apple.rapport" + "com.apple.sbd" + "com.apple.security.sos" + "com.apple.siri.osprey" + "com.apple.telephonyutilities.callservicesd" + "ichat" + "wifianalyticsd" + ) + +echo "" > $ENTITLEMENT_PATH +echo "" >> $ENTITLEMENT_PATH +echo "" >> ENTITLEMENT_PATH +echo " " >> $ENTITLEMENT_PATH +echo " keychain-access-groups" >> $ENTITLEMENT_PATH +echo " " >> $ENTITLEMENT_PATH + +sqlite3 /var/Keychains/keychain-2.db "SELECT DISTINCT agrp FROM genp" > ./allgroups.txt +sqlite3 /var/Keychains/keychain-2.db "SELECT DISTINCT agrp FROM cert" >> ./allgroups.txt +sqlite3 /var/Keychains/keychain-2.db "SELECT DISTINCT agrp FROM inet" >> ./allgroups.txt +sqlite3 /var/Keychains/keychain-2.db "SELECT DISTINCT agrp FROM keys" >> ./allgroups.txt + +while IFS= read -r line; do + dbKeychainArray+=("$line") + if [[ ! " ${invalidKeychainArray[@]} " =~ " ${line} " ]]; then + echo " ${line}">> $ENTITLEMENT_PATH + else + echo "Skipping ${line}" + fi +done < ./allgroups.txt + +# cat ./allgroups.txt | sed 's/.*/\ \ \ \ \ \ \ \ \&\<\/string\>/' >> $ENTITLEMENT_PATH +rm ./allgroups.txt + +echo " ">> $ENTITLEMENT_PATH +echo " platform-application ">> $ENTITLEMENT_PATH +echo " com.apple.private.security.no-container ">> $ENTITLEMENT_PATH +echo " ">> $ENTITLEMENT_PATH +echo "">> $ENTITLEMENT_PATH + +cd $KEYCHAIN_DUMPER_FOLDER +ldid -Sent.xml keychain_dumper +rm ent.xml +echo "Entitlements updated"