Smol adjustments
This commit is contained in:
5
.idea/workspace.xml
generated
5
.idea/workspace.xml
generated
@@ -13,7 +13,6 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="b2f61e55-9467-486e-b84a-47b98c1101b5" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/libusb_helpers.c" beforeDir="false" afterPath="$PROJECT_DIR$/libusb_helpers.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
|
||||
</list>
|
||||
@@ -26,6 +25,7 @@
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
@@ -85,7 +85,8 @@
|
||||
<path value="$PROJECT_DIR$/libusb" />
|
||||
</ignored-roots>
|
||||
<MESSAGE value="Fixed the weird libusb issue..." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Fixed the weird libusb issue..." />
|
||||
<MESSAGE value="ohmygod it worked (once)" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ohmygod it worked (once)" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
8
main.c
8
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);
|
||||
|
||||
Reference in New Issue
Block a user