mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-22 18:19:49 +02:00
fix passstat_cmd
This commit is contained in:
1 parent
e196349b2f
commit
2f306e6fcf
3 files changed
+17
-13
No files matched your search
+1
-1
@@ -133,7 +133,7 @@ int unsubscribe_cmd();
|
||||
int devinfo_cmd(devinfo_t *dev, const char *udid);
|
||||
int enter_recovery_cmd(const char* udid);
|
||||
int reboot_cmd(const char* udid);
|
||||
int passstat_cmd(char* status, const char* udid);
|
||||
int passstat_cmd(unsigned char* status, const char* udid);
|
||||
int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid);
|
||||
int autoboot_cmd(const uint64_t ecid);
|
||||
int exitrecv_cmd(const uint64_t ecid);
|
||||
|
||||
+12
-10
@@ -251,7 +251,7 @@ int reboot_cmd(const char* udid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int passstat_cmd(char* status, const char* udid) {
|
||||
int passstat_cmd(unsigned char* status, const char* udid) {
|
||||
lockdownd_error_t lerr = LOCKDOWN_E_SUCCESS;
|
||||
diagnostics_relay_error_t derr = DIAGNOSTICS_RELAY_E_SUCCESS;
|
||||
|
||||
@@ -273,7 +273,7 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
if ((lerr != LOCKDOWN_E_SUCCESS) || !lockdown)
|
||||
{
|
||||
idevice_free(dev);
|
||||
LOG(LOG_ERROR, "Error connecting to lockdownd (lockdownd error %d)", lerr);
|
||||
LOG(LOG_ERROR, "Error connecting to lockdownd (lockdownd error %d: (%s))", lerr, lockdownd_strerror(lerr));
|
||||
return -1;
|
||||
}
|
||||
lerr = lockdownd_start_service(lockdown, "com.apple.mobile.diagnostics_relay", &service);
|
||||
@@ -284,7 +284,7 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
if ((lerr != LOCKDOWN_E_SUCCESS) || !service)
|
||||
{
|
||||
idevice_free(dev);
|
||||
LOG(LOG_ERROR, "Error starting diagnostics service (lockdownd error %d)\nUnlock the device and try again.", lerr);
|
||||
LOG(LOG_ERROR, "Error starting diagnostics service (lockdownd error %d: (%s))\nUnlock the device and try again.", lerr, lockdownd_strerror(lerr));
|
||||
return -1;
|
||||
}
|
||||
derr = diagnostics_relay_client_new(dev, service, &diagnostics_client);
|
||||
@@ -292,7 +292,7 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
{
|
||||
lockdownd_service_descriptor_free(service);
|
||||
idevice_free(dev);
|
||||
LOG(LOG_ERROR, "Error starting diagnostics client (lockdownd error %d)", derr);
|
||||
LOG(LOG_ERROR, "Error starting diagnostics client (diagnostics error %d)", derr);
|
||||
return -1;
|
||||
}
|
||||
keys = plist_new_array();
|
||||
@@ -306,7 +306,7 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
|
||||
if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
|
||||
{
|
||||
LOG(LOG_ERROR, "Error getting passcode state (lockdownd error %d)", lerr);
|
||||
LOG(LOG_ERROR, "Error getting passcode state (lockdownd error %d: (%s))", lerr, lockdownd_strerror(lerr));
|
||||
return -1;
|
||||
}
|
||||
status_node = plist_access_path(node, 2, "MobileGestalt", "Status");
|
||||
@@ -316,18 +316,19 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
LOG(LOG_ERROR, "Error getting passcode state (invalid status node)");
|
||||
return -1;
|
||||
}
|
||||
plist_get_string_val(status_node, &status);
|
||||
if (!status || strncmp(status, "Succ", 4))
|
||||
char* passstat_status;
|
||||
plist_get_string_val(status_node, &passstat_status);
|
||||
if (!status || strncmp(passstat_status, "Succ", 4))
|
||||
{
|
||||
if (status)
|
||||
free(status);
|
||||
if (passstat_status)
|
||||
free(passstat_status);
|
||||
|
||||
plist_free(node);
|
||||
LOG(LOG_ERROR, "Error getting passcode state (invalid status)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(status);
|
||||
free(passstat_status);
|
||||
value_node = plist_access_path(node, 2, "MobileGestalt", "xsaMbRQ5rQ+eyKMKG+ZSSg");
|
||||
if (!value_node)
|
||||
{
|
||||
@@ -339,6 +340,7 @@ int passstat_cmd(char* status, const char* udid) {
|
||||
plist_get_bool_val(value_node, &passcode_state);
|
||||
plist_free(node);
|
||||
*status = passcode_state;
|
||||
LOG(LOG_VERBOSE4, "Passcode state: %hhu", *status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -59,16 +59,18 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||
LOG(LOG_WARNING, "Ignoring non-arm64 device...");
|
||||
return -1;
|
||||
}
|
||||
if (strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||
char passcode_state = 0;
|
||||
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||
unsigned char passcode_state = 0;
|
||||
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
||||
if (ret != 0) {
|
||||
LOG(LOG_ERROR, "Failed to get passcode state");
|
||||
devinfo_free(&dev);
|
||||
return -1;
|
||||
}
|
||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled\n", dev.productType);
|
||||
if (passcode_state) {
|
||||
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since restore on iOS 16+");
|
||||
devinfo_free(&dev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user