Reverted some silly changes
This commit is contained in:
@@ -5,13 +5,26 @@
|
||||
#include "checkm8.h"
|
||||
#include "libusb_helpers.h"
|
||||
|
||||
int complete_stage(struct libusb_device_bundle *bundle, int stage_function(struct libusb_device_bundle *bundle))
|
||||
int complete_stage(int stage_function(struct libusb_device_bundle *bundle))
|
||||
{
|
||||
libusb_open(bundle->device, &bundle->handle);
|
||||
libusb_set_auto_detach_kernel_driver(bundle->handle, 1);
|
||||
libusb_context *usb_ctx = NULL;
|
||||
struct libusb_device_bundle usb_bundle;
|
||||
int ret;
|
||||
|
||||
int ret = stage_function(bundle);
|
||||
libusb_close(bundle->handle);
|
||||
libusb_init(&usb_ctx);
|
||||
ret = get_test_device(usb_ctx, &usb_bundle);
|
||||
if(ret != 0)
|
||||
{
|
||||
printf("Error: could not find test device\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
libusb_open(usb_bundle.device, &usb_bundle.handle);
|
||||
libusb_set_auto_detach_kernel_driver(usb_bundle.handle, 1);
|
||||
|
||||
ret = stage_function(&usb_bundle);
|
||||
libusb_close(usb_bundle.handle);
|
||||
libusb_exit(usb_ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -95,30 +108,23 @@ int check_function(struct libusb_device_bundle *bundle)
|
||||
|
||||
int exploit_device()
|
||||
{
|
||||
libusb_context *usb_ctx = NULL;
|
||||
struct libusb_device_bundle usb_bundle;
|
||||
|
||||
libusb_init(&usb_ctx);
|
||||
get_test_device(usb_ctx, &usb_bundle);
|
||||
|
||||
int ret = complete_stage(&usb_bundle, stage1_function);
|
||||
int ret = complete_stage(stage1_function);
|
||||
if(ret == 0)
|
||||
{
|
||||
ret = complete_stage(&usb_bundle, stage2_function);
|
||||
ret = complete_stage(stage2_function);
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
ret = complete_stage(&usb_bundle, stage3_function);
|
||||
ret = complete_stage(stage3_function);
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
ret = complete_stage(&usb_bundle, check_function);
|
||||
ret = complete_stage(check_function);
|
||||
}
|
||||
|
||||
libusb_exit(usb_ctx);
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user