Skip to content

Commit

Permalink
prepare leetdown for A5 & A6 support and fix iPad issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rA9stuff authored Aug 6, 2021
1 parent ad8a400 commit 4afab2a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
6 changes: 4 additions & 2 deletions LeetDown_M/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZJv-6a-Efl">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZJv-6a-Efl" userLabel="SelectIPSWoutlet">
<rect key="frame" x="95" y="90" width="154" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Select 10.3.3 iPSW" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ev1-ew-Rgy">
<buttonCell key="cell" type="push" title="Waiting for a device" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ev1-ew-Rgy">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
Expand Down Expand Up @@ -210,6 +210,8 @@
<outlet property="header" destination="X81-Hw-SP5" id="YEw-jY-yfl"/>
<outlet property="ramiel" destination="cam-ls-BFA" id="Nbw-B5-FOS"/>
<outlet property="selectIPSWoutlet" destination="ZJv-6a-Efl" id="cN3-dk-2V9"/>
<outlet property="selectiPSWOutlet" destination="ZJv-6a-Efl" id="Zzr-iM-r1A"/>
<outlet property="selectiPSWoutlet" destination="ZJv-6a-Efl" id="xR8-Xv-nYd"/>
<outlet property="statusbox" destination="K2L-yj-Yqg" id="nCP-JW-00y"/>
<outlet property="statuslabel" destination="b67-hY-VIW" id="jtz-cl-2qR"/>
<outlet property="uselessIndicator" destination="JUx-Tm-U7J" id="UnE-YW-efT"/>
Expand Down
3 changes: 2 additions & 1 deletion LeetDown_M/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

@property (weak) IBOutlet NSScrollView *statusbox;
@property (unsafe_unretained) IBOutlet NSTextView *statuslabel;
@property (weak) IBOutlet NSButton *selectIPSWoutlet;
@property (assign) IBOutlet NSButton *selectIPSWoutlet;

@property (weak) IBOutlet NSTextField *ramiel;
@property (weak) IBOutlet NSButton *downgradeButtonOut;
@property (weak) IBOutlet NSProgressIndicator *uselessIndicator;
Expand Down
31 changes: 25 additions & 6 deletions LeetDown_M/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,23 @@ - (void) PrintDevInfo:(irecv_client_t)tempcli device:(irecv_device_t)tempdev {
connected = true;
irecv_devices_get_device_by_client(tempcli, &tempdev);
const struct irecv_device_info *devinfo = irecv_get_device_info(tempcli);

NSString *destination = NULL;
const char *chipcmp = [[NSString stringWithFormat:@"%@", NSCPID(&devinfo -> cpid)] cStringUsingEncoding:NSASCIIStringEncoding];
if (strcmp(chipcmp, "8960") == 0 || strcmp(chipcmp, "8965") == 0) {
destination = @"10.3.3";
}
else if (strcmp(chipcmp, "8950") == 0 || strcmp(chipcmp, "8955") == 0 || strcmp(chipcmp, "8945") == 0) {
destination = @"8.4.1";
}
else {
const char *devmodel = [[NSString stringWithFormat:@"%s", tempdev -> product_type] cStringUsingEncoding:NSASCIIStringEncoding];
if (strcmp(devmodel, "iPhone4,1") == 0 || strcmp(devmodel, "iPad2,1") == 0 || strcmp(devmodel, "iPad2,2") == 0 || strcmp(devmodel, "iPad2,3") == 0) {
destination = @"6.1.3 or 8.4.1";
}
else if (strcmp(devmodel, "iPad2,3") == 0) {
destination = @"8.4.1";
}
}
NSString *stag = [NSString stringWithFormat:@"%s", devinfo -> serial_string];
if ([stag containsString:@"PWND:[checkm8]"]) {
pwned = true;
Expand All @@ -394,6 +410,8 @@ - (void) PrintDevInfo:(irecv_client_t)tempcli device:(irecv_device_t)tempdev {
[self infoLog: [NSString stringWithFormat:@"%@", NSNonce(devinfo -> sep_nonce, devinfo -> sep_nonce_size)] color:[NSColor greenColor]];
[self infoLog:@"\nCPID: " color:[NSColor cyanColor]];
[self infoLog: [NSString stringWithFormat:@"%@", NSCPID(&devinfo -> cpid)] color:[NSColor greenColor]];
[self infoLog: @"\nDestination firmware: " color:[NSColor cyanColor]];
[self infoLog: destination color:[NSColor greenColor]];
[self infoLog:@"\nPwned: " color:[NSColor cyanColor]];
irecv_close(tempcli);
if (ispwned(tempcli, tempdev)) {
Expand All @@ -402,7 +420,7 @@ - (void) PrintDevInfo:(irecv_client_t)tempcli device:(irecv_device_t)tempdev {
else {
[self infoLog: @"No" color:[NSColor greenColor]];
}
[self infoLog: @"\n\n=======================================" color:[NSColor cyanColor]];
[self infoLog: @"\n=======================================" color:[NSColor cyanColor]];
}
}

Expand Down Expand Up @@ -523,6 +541,7 @@ - (void) Discover:(irecv_client_t)client device:(irecv_device_t)dev {
supported = true;
dispatch_async(dispatch_get_main_queue(), ^(){
self -> _selectIPSWoutlet.enabled = true;
self -> _selectIPSWoutlet.title = @"Select 10.3.3 iPSW";

[self updateStatus:[NSString stringWithFormat: @"%s is supported", dev -> display_name] color:[NSColor greenColor]];

Expand Down Expand Up @@ -687,6 +706,7 @@ - (IBAction)downgradeButtonAct:(id)sender {
[self -> _uselessIndicator stopAnimation:nil];
[self updateStatus:@"Failed to exploit device, please re-enter DFU mode and try again" color:[NSColor redColor]];
_dfuhelpoutlet.enabled = true;
_dfuhelpoutlet.alphaValue = 1;
_downgradeButtonOut.enabled = true;
});
return;
Expand All @@ -708,18 +728,18 @@ - (IBAction)downgradeButtonAct:(id)sender {
[self sendFile:cli device:dev filename:@"/dev/null"];
sleep(5);

if (strcmp(boardcmp, "n51ap") || strcmp(boardcmp, "n53ap")) {
if (strcmp(boardcmp, "n51ap") == 0 || strcmp(boardcmp, "n53ap") == 0) {
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBSS.iphone6.RELEASE.im4p"]];
sleep(5);
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBEC.iphone6.RELEASE.im4p"]];
}

else if (strcmp(boardcmp, "j71ap") || strcmp(boardcmp, "j72ap") || strcmp(boardcmp, "j73ap")) {
else if (strcmp(boardcmp, "j71ap") == 0 || strcmp(boardcmp, "j72ap") == 0 || strcmp(boardcmp, "j73ap") == 0) {
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBSS.ipad4.RELEASE.im4p"]];
sleep(5);
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBEC.ipad4.RELEASE.im4p"]];
}
else if (strcmp(boardcmp, "j85ap") || strcmp(boardcmp, "j86ap")) {
else if (strcmp(boardcmp, "j85ap") == 0 || strcmp(boardcmp, "j86ap") == 0) {
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBSS.ipad4b.RELEASE.im4p"]];
sleep(5);
[self sendFile:cli device:dev filename: [tempipswdir stringByAppendingString:@"/Firmware/DFU/iBEC.ipad4b.RELEASE.im4p"]];
Expand Down Expand Up @@ -765,7 +785,6 @@ - (void)viewDidLoad {
_header.stringValue = @"1337Down";
_ramiel.stringValue = @"Okay Ramiel did it first but you have 1 in a 1000 chances of seeing\n 1337Down";
}

irecv_device_t tempdev = NULL;
irecv_client_t tempcli = NULL;

Expand Down

0 comments on commit 4afab2a

Please sign in to comment.