Procházet zdrojové kódy

Initial upload

master
wxb1ank před 4 roky
revize
6f2a417332
4 změnil soubory, kde provedl 111 přidání a 0 odebrání
  1. +13
    -0
      Makefile
  2. +9
    -0
      control
  3. +8
    -0
      ent.xml
  4. +81
    -0
      main.m

+ 13
- 0
Makefile Zobrazit soubor

@@ -0,0 +1,13 @@
ARCHS = arm64 arm64e
TARGET = iphone::latest

include $(THEOS)/makefiles/common.mk

TOOL_NAME = lockpick

lockpick_FILES = main.m
lockpick_CFLAGS = -fobjc-arc
lockpick_PRIVATE_FRAMEWORKS = ManagedConfiguration SpringBoard
lockpick_CODESIGN_FLAGS = -Sent.xml

include $(THEOS_MAKE_PATH)/tool.mk

+ 9
- 0
control Zobrazit soubor

@@ -0,0 +1,9 @@
Package: com.wxblank.lockpick
Name: lockpick
Version: 0.0.1
Architecture: iphoneos-arm
Description: lock/unlock the device
Maintainer: wxblank <wxblank@gmail.com>
Author: wxblank <wxblank@gmail.com>
Section: System
Tag: role::hacker

+ 8
- 0
ent.xml Zobrazit soubor

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.springboard-ui.client</key>
<true/>
</dict>
</plist>

+ 81
- 0
main.m Zobrazit soubor

@@ -0,0 +1,81 @@
#include <stdio.h>
#include <string.h>

#import <Foundation/Foundation.h>

#define PROG_NAME "lockpick"

@interface MCPasscodeManager : NSObject

+ (MCPasscodeManager *)sharedManager;

+ (BOOL)isDeviceUnlocked;
+ (BOOL)isDeviceLocked;
- (BOOL)isPasscodeSet;

- (void)lockDevice;
- (BOOL)unlockDeviceWithPasscode:(id)passcode outError:(out NSError * _Nullable *)error;

@end

@interface SBLockdownManager : NSObject

+ (SBLockdownManager *)sharedInstance;

@end

void print_usage() {
printf("Usage: %s lock\n", PROG_NAME);
printf(" %s unlock [passcode]\n", PROG_NAME);
}

int main(int argc, char *argv[]) {
if(argc == 1) {
print_usage();
return 0;
}

if(strcmp(argv[1], "lock") == 0) {
if([MCPasscodeManager isDeviceUnlocked]) {
[[MCPasscodeManager sharedManager] lockDevice];
} else {
fprintf(stderr, "Device is already locked.\n");
return 1;
}
}
else if(strcmp(argv[1], "unlock") == 0) {
NSError *error = nil;

if(![MCPasscodeManager isDeviceUnlocked]) {
if(![MCPasscodeManager sharedManager].isPasscodeSet) {
[[MCPasscodeManager sharedManager] unlockDeviceWithPasscode:nil outError:&error];
if(error) {
fprintf(stderr, "Couldn't unlock device.\n");
return 1;
}
}
else if(argc < 3) {
fprintf(stderr, "This device requires a passcode.\n");
return 1;
}

NSString *givenPasscode = @(argv[2]);

[[MCPasscodeManager sharedManager] unlockDeviceWithPasscode:givenPasscode outError:&error];
if(error) {
if(error.code == 5011) {
fprintf(stderr, "Wrong passcode.\n");
return 1;
}
fprintf(stderr, "Unknown error code.\n");
return 1;
}
} else {
fprintf(stderr, "Device is already unlocked.\n");
return 1;
}
}

return 0;
}

Načítá se…
Zrušit
Uložit