Skip to content

Commit 0106df9

Browse files
author
Emery Ferrari
committed
iOS Restrictions Recovery v0.6.3
1 parent 326ab1c commit 0106df9

File tree

2 files changed

+76
-32
lines changed

2 files changed

+76
-32
lines changed

src/com/emeryferrari/iosrr/Display.java

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public boolean accept(File current, String name) {
7474
JButton button = new JButton(plist.getModelName() + " / " + plist.getiOSVersion() + " / " + plist.getBackupDate() + " / " + plist.getDisplayName() + " / " + plist.getDeviceName());
7575
if (plist.getiOSRelease() < 7 || plist.getiOSRelease() > 11) {
7676
button.setEnabled(false);
77+
} else if (!new File(plist.getFile() + "398bc9c2aeeab4cb0c12ada0f52eea12cf14f40b").exists()) {
78+
button.setEnabled(false);
7779
}
7880
button.addActionListener(Display.CLASS_OBJ.new BackupListener(i));
7981
Display.FRAME.getContentPane().add(button);
@@ -96,17 +98,27 @@ public BackupListener(int index) {
9698
public void actionPerformed(ActionEvent ev) {
9799
try {
98100
KeySaltPair pair = PropertyListReader.getKeyAndSaltFromPlist(plists[index].getFile() + "398bc9c2aeeab4cb0c12ada0f52eea12cf14f40b");
99-
Display.FRAME.getContentPane().add(new JLabel("<html><body><strong>Calculating passcode...</strong></body></html>"));
100-
Display.refresh();
101-
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
102-
if (passcode == null) {
103-
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
104-
} else {
105-
JOptionPane.showMessageDialog(null, "Passcode: " + passcode);
106-
}
107-
Display.FRAME.getContentPane().removeAll();
108-
Display.createDisplay();
101+
JLabel label = new JLabel("<html><body><strong>Calculating passcode...</strong></body></html>");
102+
Display.FRAME.getContentPane().add(label);
109103
Display.refresh();
104+
Thread thread = new Thread() {
105+
@Override
106+
public void run() {
107+
try {
108+
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
109+
if (passcode == null) {
110+
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
111+
} else {
112+
JOptionPane.showMessageDialog(null, "Passcode: " + passcode, "Passcode found!", 0);
113+
}
114+
Display.FRAME.getContentPane().remove(label);
115+
Display.refresh();
116+
} catch (Exception ex) {
117+
Display.handleException(ex, true);
118+
}
119+
}
120+
};
121+
thread.start();
110122
} catch (Exception ex) {
111123
Display.handleException(ex, true);
112124
}
@@ -130,12 +142,22 @@ public void actionPerformed(ActionEvent ev) {
130142
String salt = JOptionPane.showInputDialog("Salt?");
131143
Display.DESC.setText("<html><b>Calculating passcode...</b></html>");
132144
Display.refresh();
133-
String passcode = RestrictionsRecovery.calculate(key, salt, false);
134-
if (passcode == null) {
135-
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
136-
} else {
137-
JOptionPane.showMessageDialog(null, "Passcode: " + passcode);
138-
}
145+
Thread thread = new Thread() {
146+
@Override
147+
public void run() {
148+
try {
149+
String passcode = RestrictionsRecovery.calculate(key, salt, false);
150+
if (passcode == null) {
151+
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
152+
} else {
153+
JOptionPane.showMessageDialog(null, "Passcode: " + passcode, "Passcode found!", 0);
154+
}
155+
} catch (Exception ex) {
156+
Display.handleException(ex, true);
157+
}
158+
}
159+
};
160+
thread.start();
139161
} catch (Exception ex) {
140162
Display.handleException(ex, true);
141163
}
@@ -150,12 +172,22 @@ public void actionPerformed(ActionEvent ev) {
150172
KeySaltPair pair = PropertyListReader.getKeyAndSaltFromPlist(file);
151173
Display.DESC.setText("<html><b>Calculating passcode...</b></html>");
152174
Display.refresh();
153-
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
154-
if (passcode == null) {
155-
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
156-
} else {
157-
JOptionPane.showMessageDialog(null, "Passcode: " + passcode);
158-
}
175+
Thread thread = new Thread() {
176+
@Override
177+
public void run() {
178+
try {
179+
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
180+
if (passcode == null) {
181+
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
182+
} else {
183+
JOptionPane.showMessageDialog(null, "Passcode: " + passcode, "Passcode found!", 0);
184+
}
185+
} catch (Exception ex) {
186+
Display.handleException(ex, true);
187+
}
188+
}
189+
};
190+
thread.start();
159191
} catch (Exception ex) {
160192
Display.handleException(ex, true);
161193
}
@@ -171,14 +203,26 @@ public void actionPerformed(ActionEvent ev) {
171203
String port = JOptionPane.showInputDialog("Device SSH port?");
172204
Display.DESC.setText("<html><b>Calculating passcode...</b></html>");
173205
Display.refresh();
174-
RestrictionsRecovery.downloadViaSSH(ip, Integer.parseInt(port), password, false);
175-
KeySaltPair pair = PropertyListReader.getKeyAndSaltFromPlist("password.plist");
176-
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
177-
if (passcode == null) {
178-
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
179-
} else {
180-
JOptionPane.showMessageDialog(null, "Passcode: " + passcode);
181-
}
206+
Thread thread = new Thread() {
207+
@Override
208+
public void run() {
209+
try {
210+
Display.DESC.setText("Downloading passcode from device...");
211+
RestrictionsRecovery.downloadViaSSH(ip, Integer.parseInt(port), password, false);
212+
Display.DESC.setText("Bruteforcing passcode...");
213+
KeySaltPair pair = PropertyListReader.getKeyAndSaltFromPlist("password.plist");
214+
String passcode = RestrictionsRecovery.calculate(pair.getKey(), pair.getSalt(), false);
215+
if (passcode == null) {
216+
throw new Exception("Passcode could not be found. Key and salt does not correspond to any passcode between 0000 and 9999.");
217+
} else {
218+
JOptionPane.showMessageDialog(null, "Passcode: " + passcode, "Passcode found!", 0);
219+
}
220+
} catch (Exception ex) {
221+
Display.handleException(ex, true);
222+
}
223+
}
224+
};
225+
thread.start();
182226
} catch (Exception ex) {
183227
Display.handleException(ex, true);
184228
}
@@ -194,7 +238,7 @@ public void actionPerformed(ActionEvent ev) {
194238
private static void handleException(Exception ex, boolean message) {
195239
ex.printStackTrace();
196240
if (message) {
197-
JOptionPane.showMessageDialog(null, "Error: " + ex.getClass().toString().split(" ")[1] + ": " + ex.getMessage());
241+
JOptionPane.showMessageDialog(null, "Error: " + ex.getClass().toString().split(" ")[1] + ": " + ex.getMessage(), "An exception has occurred", 0);
198242
}
199243
}
200244
}

src/com/emeryferrari/iosrr/RRConst.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
public class RRConst {
33
private RRConst() {}
44
public static final String NAME = "iOS-Restrictions-Recovery";
5-
public static final String VERSION = "v0.6.2";
5+
public static final String VERSION = "v0.6.3";
66
public static final String TITLE = "<html><body><font size=\"6\">" + NAME + " " + VERSION + "</font></body></html>";
77
public static final String DESC = "<html><body>Compatible <strong>only</strong> with <strong>iOS 7.0</strong> through <strong>iOS 11.4.1</strong></body></html>";
88
public static final String KEY_SALT_BUTTON = "From key and salt";

0 commit comments

Comments
 (0)