diff --git a/CMakeLists.txt b/CMakeLists.txt index 0136d4e..c7390e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,9 @@ cmake_minimum_required(VERSION 3.10) project(ipwndfu_rewrite_c) +enable_language(C) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_FLAGS -g) - -add_executable(ipwndfu main.c conf.h - exploit/libusb_helpers.c exploit/libusb_helpers.h - exploit/exploit.c exploit/checkm8.h exploit/commands.c) - -add_library(libusb_checkm8 - conf.h libusb/config.h +add_library(checkm8_libusb + checkm8_remote/conf.h libusb/config.h libusb/src/core.c libusb/src/descriptor.c libusb/src/hotplug.c libusb/src/io.c libusb/src/strerror.c libusb/src/sync.c @@ -19,4 +13,5 @@ add_library(libusb_checkm8 libusb/src/os/threads_posix.c libusb/src/os/poll_posix.c libusb/src/os/linux_usbfs.h libusb/src/os/threads_posix.h libusb/src/os/poll_posix.h) -target_link_libraries(ipwndfu libusb_checkm8 pthread udev) +add_subdirectory(checkm8_remote) +add_subdirectory(checkm8_payload) diff --git a/checkm8_payload/CMakeLists.txt b/checkm8_payload/CMakeLists.txt new file mode 100644 index 0000000..09690cb --- /dev/null +++ b/checkm8_payload/CMakeLists.txt @@ -0,0 +1,6 @@ +enable_language(ASM) + +set(CMAKE_SYSTEM_PROCESSOR arm) +set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc) +set(CMAKE_ASM_COMPILER /usr/bin/aarch64-linux-gnu-as) + diff --git a/checkm8_remote/CMakeLists.txt b/checkm8_remote/CMakeLists.txt new file mode 100644 index 0000000..bdafbe2 --- /dev/null +++ b/checkm8_remote/CMakeLists.txt @@ -0,0 +1,9 @@ +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_FLAGS -g) + +add_executable(checkm8_remote main.c conf.h + libusb_helpers.c libusb_helpers.h exploit.c + checkm8.h commands.c) + + +target_link_libraries(checkm8_remote libusb_checkm8 pthread udev) \ No newline at end of file diff --git a/exploit/bin/overwrite.bin b/checkm8_remote/bin/overwrite.bin similarity index 100% rename from exploit/bin/overwrite.bin rename to checkm8_remote/bin/overwrite.bin diff --git a/exploit/bin/payload.bin b/checkm8_remote/bin/payload.bin similarity index 100% rename from exploit/bin/payload.bin rename to checkm8_remote/bin/payload.bin diff --git a/exploit/checkm8.h b/checkm8_remote/checkm8.h similarity index 100% rename from exploit/checkm8.h rename to checkm8_remote/checkm8.h diff --git a/exploit/commands.c b/checkm8_remote/commands.c similarity index 100% rename from exploit/commands.c rename to checkm8_remote/commands.c diff --git a/conf.h b/checkm8_remote/conf.h similarity index 100% rename from conf.h rename to checkm8_remote/conf.h diff --git a/exploit/exploit.c b/checkm8_remote/exploit.c similarity index 95% rename from exploit/exploit.c rename to checkm8_remote/exploit.c index 6d8fbff..e1ec907 100644 --- a/exploit/exploit.c +++ b/checkm8_remote/exploit.c @@ -65,12 +65,12 @@ int stage3_function(struct libusb_device_bundle *bundle) { printf("~~~ Exploit stage 3 ~~~\n"); unsigned char overwrite_buf[1524]; - FILE *overwrite_file = fopen("/home/grg/Projects/School/NCSU/iphone_aes_sc/ipwndfu_rewrite_c/exploit/bin/overwrite.bin", "r"); + FILE *overwrite_file = fopen("/home/grg/Projects/School/NCSU/iphone_aes_sc/ipwndfu_rewrite_c/checkm8_remote/bin/overwrite.bin", "r"); fread(overwrite_buf, 1524, 1, overwrite_file); fclose(overwrite_file); unsigned char payload_buf[2400]; - FILE *payload_file = fopen("/home/grg/Projects/School/NCSU/iphone_aes_sc/ipwndfu_rewrite_c/exploit/bin/payload.bin", "r"); + FILE *payload_file = fopen("/home/grg/Projects/School/NCSU/iphone_aes_sc/ipwndfu_rewrite_c/checkm8_remote/bin/payload.bin", "r"); fread(payload_buf, 2400, 1, payload_file); fclose(payload_file); diff --git a/exploit/libusb_helpers.c b/checkm8_remote/libusb_helpers.c similarity index 100% rename from exploit/libusb_helpers.c rename to checkm8_remote/libusb_helpers.c diff --git a/exploit/libusb_helpers.h b/checkm8_remote/libusb_helpers.h similarity index 100% rename from exploit/libusb_helpers.h rename to checkm8_remote/libusb_helpers.h diff --git a/main.c b/checkm8_remote/main.c similarity index 74% rename from main.c rename to checkm8_remote/main.c index 3119775..988ef01 100644 --- a/main.c +++ b/checkm8_remote/main.c @@ -6,7 +6,7 @@ int main() int status = exploit_device(); if(status != 0) { - printf("Failed to exploit device\n"); + printf("Failed to checkm8_remote device\n"); return status; } diff --git a/exploit/shellcode/shellcode.c b/checkm8_remote/shellcode/shellcode.c similarity index 100% rename from exploit/shellcode/shellcode.c rename to checkm8_remote/shellcode/shellcode.c diff --git a/libusb/config.h b/libusb/config.h index 8b43cfb..54e812a 100644 --- a/libusb/config.h +++ b/libusb/config.h @@ -1,7 +1,7 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ -#include "../conf.h" +#include "../checkm8_remote/conf.h" /* Default visibility */ #define DEFAULT_VISIBILITY __attribute__((visibility("default")))