mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 01:37:02 +02:00
refactor(build): de-dup definitions & manifest changes
This commit is contained in:
1 parent
7f57325f7d
commit
443bacdc8d
9 files changed
+61
-51
No files matched your search
+8
-8
@@ -102,7 +102,7 @@ if(APPLE AND WITH_GUI)
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist
|
||||
MACOSX_BUNDLE_ICON_FILE palera1n.icns
|
||||
)
|
||||
elseif(MINGW OR MSYS AND WITH_GUI)
|
||||
elseif(MINGW AND WITH_GUI)
|
||||
set(APP_MANIFEST_RC ${CMAKE_SOURCE_DIR}/resources/app.rc)
|
||||
add_executable(palera1n WIN32 ${SOURCES} ${APP_MANIFEST_RC})
|
||||
else()
|
||||
@@ -164,7 +164,7 @@ if(WITH_STATIC)
|
||||
mbedtls_LIBS=-lmbedtls\ -lmbedx509\ -lmbedcrypto
|
||||
)
|
||||
|
||||
if(MINGW OR MSYS)
|
||||
if(MINGW)
|
||||
set(IMD_AUTOTOOLS_ARGS
|
||||
--disable-static
|
||||
--enable-shared
|
||||
@@ -179,7 +179,7 @@ if(WITH_STATIC)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT MINGW AND NOT MSYS)
|
||||
if(NOT MINGW)
|
||||
# =========================
|
||||
# mbedTLS
|
||||
# =========================
|
||||
@@ -200,7 +200,7 @@ if(WITH_STATIC)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LINUX OR MINGW OR MSYS)
|
||||
if(LINUX OR MINGW)
|
||||
# =========================
|
||||
# libusb
|
||||
# =========================
|
||||
@@ -318,11 +318,11 @@ if(WITH_STATIC)
|
||||
limd_glue_ep
|
||||
)
|
||||
|
||||
if(NOT MINGW AND NOT MSYS)
|
||||
if(NOT MINGW)
|
||||
list(APPEND LIBIMOBILEDEVICE_DEPS mbedtls_ep)
|
||||
endif()
|
||||
|
||||
if(LINUX OR MINGW OR MSYS)
|
||||
if(LINUX OR MINGW)
|
||||
list(APPEND LIBIMOBILEDEVICE_DEPS libusb_ep)
|
||||
endif()
|
||||
|
||||
@@ -404,7 +404,7 @@ if(WITH_STATIC)
|
||||
libirecovery_ep
|
||||
)
|
||||
|
||||
if(NOT MINGW AND NOT MSYS)
|
||||
if(NOT MINGW)
|
||||
add_dependencies(palera1n mbedtls_ep)
|
||||
endif()
|
||||
|
||||
@@ -428,7 +428,7 @@ if(WITH_STATIC)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MINGW OR MSYS)
|
||||
if(MINGW)
|
||||
target_link_libraries(palera1n PRIVATE
|
||||
imobiledevice-1.0
|
||||
irecovery-1.0
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="app"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="app"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
@@ -16,6 +16,16 @@
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel
|
||||
level="requireAdministrator"
|
||||
uiAccess="false"
|
||||
/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
+2
-2
@@ -157,7 +157,7 @@ void recovery_device_event_cb(
|
||||
|
||||
if (client)
|
||||
{
|
||||
VERBOSE("Opened client after %d attempts", attempts);
|
||||
LOG_VERBOSE("Opened client after %d attempts", attempts);
|
||||
|
||||
irecv_device_t device = nullptr;
|
||||
if (irecv_devices_get_device_by_client(client, &device) == IRECV_E_SUCCESS && device)
|
||||
@@ -170,7 +170,7 @@ void recovery_device_event_cb(
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR("Failed to open irecv client after retries");
|
||||
LOG_ERROR("Failed to open irecv client after retries");
|
||||
}
|
||||
|
||||
state.isSupported = SequenceIsSupported(state.productType);
|
||||
|
||||
+6
-6
@@ -165,28 +165,28 @@ bool checkm8_stage_patch(const usb_handle_t *handle, struct DeviceConfiguration
|
||||
create_pongo_payload_for_device(deviceConfig->cpid, &payload, &data_sz);
|
||||
|
||||
if (payload == NULL || data_sz == 0) {
|
||||
ERROR("unsupported cpid 0x%X", (unsigned)deviceConfig->cpid);
|
||||
LOG_ERROR("unsupported cpid 0x%X", (unsigned)deviceConfig->cpid);
|
||||
return false;
|
||||
}
|
||||
|
||||
VERBOSE("setting up stage 2 for CPID 0x%X", (unsigned)deviceConfig->cpid);
|
||||
LOG_VERBOSE("setting up stage 2 for CPID 0x%X", (unsigned)deviceConfig->cpid);
|
||||
|
||||
data = calloc(1, data_sz);
|
||||
if (!data) {
|
||||
ERROR("failed to allocate payload buffer");
|
||||
LOG_ERROR("failed to allocate payload buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(data, payload, data_sz);
|
||||
|
||||
if(checkm8_usb_request_stall(handle) && checkm8_usb_request_leak(handle)) {
|
||||
VERBOSE("successfully leaked data");
|
||||
LOG_VERBOSE("successfully leaked data");
|
||||
} else {
|
||||
ERROR("failed to leak data");
|
||||
LOG_ERROR("failed to leak data");
|
||||
return false;
|
||||
}
|
||||
for(i = 0; i < 2; i++) {
|
||||
VERBOSE("i = %zu", i);
|
||||
LOG_VERBOSE("i = %zu", i);
|
||||
send_usb_control_request_no_data(handle, 2, 3, 0, 0x80, 0, NULL);
|
||||
}
|
||||
if(p != NULL && send_usb_control_request(handle, 0x00, 0, 0, 0x00, p, 0x30, &transfer_ret) && transfer_ret.ret == USB_TRANSFER_STALL) {
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ bool checkm8_find_device_configuration_for_cpid(
|
||||
config->config_hole = 0;
|
||||
break;
|
||||
default:
|
||||
ERROR("CPID 0x%x is not supported!", cpid);
|
||||
LOG_ERROR("CPID 0x%x is not supported!", cpid);
|
||||
foundMatchingConfiguration = false;
|
||||
break;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ bool checkm8_find_payload_configuration_for_cpid(
|
||||
config->usb_serial_number_string_descriptor = 0x18008062A;
|
||||
break;
|
||||
default:
|
||||
ERROR("CPID 0x%x is not supported!", cpid);
|
||||
LOG_ERROR("CPID 0x%x is not supported!", cpid);
|
||||
foundMatchingConfiguration = false;
|
||||
}
|
||||
return foundMatchingConfiguration;
|
||||
@@ -237,7 +237,7 @@ void create_pongo_payload_for_device(
|
||||
uint8_t **payload,
|
||||
size_t *payloadSize)
|
||||
{
|
||||
VERBOSE("Preparing YoloDFU payload for CPID 0x%x.", cpid);
|
||||
LOG_VERBOSE("Preparing YoloDFU payload for CPID 0x%x.", cpid);
|
||||
|
||||
*payload = NULL;
|
||||
*payloadSize = 0;
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ static void *pongo_thread(void *arg)
|
||||
if (!seen) {
|
||||
seen = true;
|
||||
|
||||
SUCCESS("Pongo device detected!");
|
||||
LOG_SUCCESS("Pongo device detected!");
|
||||
|
||||
char paleinfo[64];
|
||||
snprintf(paleinfo, sizeof(paleinfo), "palera1n_flags 0x%" PRIx64, palerain_flags);
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
palerain_flags |= palerain_option_verbose_boot;
|
||||
break;
|
||||
case '?':
|
||||
ERROR("Unknown option");
|
||||
LOG_ERROR("Unknown option");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
default: break;
|
||||
@@ -148,7 +148,7 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
|
||||
if (!(palerain_flags & palerain_option_gui)) {
|
||||
if (!(palerain_flags & palerain_option_rootful) && !(palerain_flags & palerain_option_rootless)) {
|
||||
ERROR("You must specify either -l, --rootless or -f, --rootful.\n");
|
||||
LOG_ERROR("You must specify either -l, --rootless or -f, --rootful.\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+15
-15
@@ -21,15 +21,15 @@ void compress_pongo(void *out, size_t *out_len) {
|
||||
|
||||
void checkm8_boot_pongo(usb_handle_t *handle) {
|
||||
transfer_ret_t transfer_ret;
|
||||
VERBOSE("Booting pongoOS");
|
||||
VERBOSE("Compressing pongoOS");
|
||||
VERBOSE("Appending shellcode to the top of pongoOS (512 bytes)");
|
||||
LOG_VERBOSE("Booting pongoOS");
|
||||
LOG_VERBOSE("Compressing pongoOS");
|
||||
LOG_VERBOSE("Appending shellcode to the top of pongoOS (512 bytes)");
|
||||
void *shellcode = malloc(512);
|
||||
memcpy(shellcode, payloads_lz4dec_bin, payloads_lz4dec_bin_len);
|
||||
size_t out_len = payloads_Pongo_bin_len;
|
||||
void *out = malloc(out_len);
|
||||
compress_pongo(out, &out_len);
|
||||
VERBOSE("Compressed pongoOS from %u to %zu bytes", payloads_Pongo_bin_len, out_len);
|
||||
LOG_VERBOSE("Compressed pongoOS from %u to %zu bytes", payloads_Pongo_bin_len, out_len);
|
||||
void *tmp = malloc(out_len + 512);
|
||||
memcpy(tmp, shellcode, 512);
|
||||
memcpy(tmp + 512, out, out_len);
|
||||
@@ -37,12 +37,12 @@ void checkm8_boot_pongo(usb_handle_t *handle) {
|
||||
out = tmp;
|
||||
out_len += 512;
|
||||
free(shellcode);
|
||||
VERBOSE("Setting the compressed size into the shellcode");
|
||||
LOG_VERBOSE("Setting the compressed size into the shellcode");
|
||||
uint32_t* size = (uint32_t*)(out + 0x1fc);
|
||||
*size = out_len - 512;
|
||||
VERBOSE("Reconnecting to device");
|
||||
LOG_VERBOSE("Reconnecting to device");
|
||||
init_usb_handle(handle, 0x5AC, 0x1227);
|
||||
VERBOSE("Waiting for device to be ready");
|
||||
LOG_VERBOSE("Waiting for device to be ready");
|
||||
wait_usb_handle(handle);
|
||||
{
|
||||
size_t len = 0;
|
||||
@@ -54,16 +54,16 @@ void checkm8_boot_pongo(usb_handle_t *handle) {
|
||||
send_usb_control_request(handle, 0x21, DFU_DNLOAD, 0, 0, (unsigned char*)&out[len], size, &transfer_ret);
|
||||
if(transfer_ret.sz != size || transfer_ret.ret != USB_TRANSFER_OK)
|
||||
{
|
||||
VERBOSE("retrying at len = %zu", len);
|
||||
LOG_VERBOSE("retrying at len = %zu", len);
|
||||
sleep_ms(100);
|
||||
goto retry;
|
||||
}
|
||||
len += size;
|
||||
VERBOSE("len = %zu", len);
|
||||
LOG_VERBOSE("len = %zu", len);
|
||||
}
|
||||
}
|
||||
send_usb_control_request_no_data(handle, 0x21, 4, 0, 0, 0, NULL);
|
||||
VERBOSE("pongoOS sent, should be booting");
|
||||
LOG_VERBOSE("pongoOS sent, should be booting");
|
||||
}
|
||||
|
||||
int issue_pongo_command(const usb_handle_t *handle, const char *command) {
|
||||
@@ -81,11 +81,11 @@ int issue_pongo_command(const usb_handle_t *handle, const char *command) {
|
||||
size_t len = strlen(command);
|
||||
|
||||
if (len > 510) {
|
||||
ERROR("Pongo command too long: %s", command);
|
||||
LOG_ERROR("Pongo command too long: %s", command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
VERBOSE("Executing PongoOS command: '%s'", command);
|
||||
LOG_VERBOSE("Executing PongoOS command: '%s'", command);
|
||||
|
||||
snprintf(command_buf, sizeof(command_buf), "%s\n", command);
|
||||
len = strlen(command_buf);
|
||||
@@ -115,7 +115,7 @@ int issue_pongo_command(const usb_handle_t *handle, const char *command) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ERROR("Pongo USB error: %d", tx_status.ret);
|
||||
LOG_ERROR("Pongo USB error: %d", tx_status.ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ int issue_pongo_command(const usb_handle_t *handle, const char *command) {
|
||||
|
||||
bool upload_buffer_to_pongo(usb_handle_t *handle, const void *data, size_t length) {
|
||||
if (data == NULL || length == 0) {
|
||||
ERROR("Invalid data buffer or length.");
|
||||
LOG_ERROR("Invalid data buffer or length.");
|
||||
return false;
|
||||
}
|
||||
|
||||
VERBOSE("Uploading %zu bytes to PongoOS...", length);
|
||||
LOG_VERBOSE("Uploading %zu bytes to PongoOS...", length);
|
||||
|
||||
bool ret = false;
|
||||
transfer_ret_t tx_status = {0};
|
||||
|
||||
+4
-4
@@ -26,10 +26,10 @@ typedef enum {
|
||||
} log_level_t;
|
||||
|
||||
#define LOG(fmt, ...) log_write(LOG_INFO, fmt, ##__VA_ARGS__)
|
||||
#define SUCCESS(fmt, ...) log_write(LOG_SUCCESS, fmt, ##__VA_ARGS__)
|
||||
#define WARN(fmt, ...) log_write(LOG_WARN, fmt, ##__VA_ARGS__)
|
||||
#define ERROR(fmt, ...) log_write(LOG_ERROR, fmt, ##__VA_ARGS__)
|
||||
#define VERBOSE(fmt, ...) log_write(LOG_VERBOSE, fmt, ##__VA_ARGS__)
|
||||
#define LOG_SUCCESS(fmt, ...) log_write(LOG_SUCCESS, fmt, ##__VA_ARGS__)
|
||||
#define LOG_WARN(fmt, ...) log_write(LOG_WARN, fmt, ##__VA_ARGS__)
|
||||
#define LOG_ERROR(fmt, ...) log_write(LOG_ERROR, fmt, ##__VA_ARGS__)
|
||||
#define LOG_VERBOSE(fmt, ...) log_write(LOG_VERBOSE, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Reference in new issue
Block a user