mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-27 19:49:48 +01:00
feat(cli): add ra1n dfu-helper for cli
supports going from recovery to dfu, only.
This commit is contained in:
1 file changed
+18
-6
+18
-6
@@ -132,7 +132,7 @@ const char* err_to_string(int err) {
|
|||||||
|
|
||||||
int exploit(int *stage)
|
int exploit(int *stage)
|
||||||
{
|
{
|
||||||
LOG("Waiting for devices...");
|
LOG("Waiting for DFU mode devices...");
|
||||||
|
|
||||||
*stage = STAGE_RESET;
|
*stage = STAGE_RESET;
|
||||||
|
|
||||||
@@ -158,7 +158,20 @@ int exploit(int *stage)
|
|||||||
if (!usb_get_client_flag(client, &flag))
|
if (!usb_get_client_flag(client, &flag))
|
||||||
goto reloop;
|
goto reloop;
|
||||||
|
|
||||||
if (flag & kDeviceDFUModeFlag) {
|
// no reason to use this for tui/gui
|
||||||
|
if ((flag & kDeviceRecoveryModeFlag) && (palerain_flags & palerain_option_cli)) {
|
||||||
|
cr = ra1n_enter_dfu(client);
|
||||||
|
if (cr == RA1N_CLIENT_ERR_NONE) {
|
||||||
|
LOG("Found DFU mode device");
|
||||||
|
usb_close(client);
|
||||||
|
*stage = STAGE_RESET;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LOG_ERROR("Failed to enter DFU mode (rv=%d, reason=%s)", cr, err_to_string(cr));
|
||||||
|
usb_close(client);
|
||||||
|
*stage = STAGE_ERROR;
|
||||||
|
break; // err
|
||||||
|
} else if (flag & kDeviceDFUModeFlag) {
|
||||||
if (flag & kDeviceStandardPwnedDFUModeFlag) {
|
if (flag & kDeviceStandardPwnedDFUModeFlag) {
|
||||||
// we cant do shit sorry
|
// we cant do shit sorry
|
||||||
LOG_ERROR("Found an unknown pwned DFU mode device");
|
LOG_ERROR("Found an unknown pwned DFU mode device");
|
||||||
@@ -273,10 +286,9 @@ int exploit(int *stage)
|
|||||||
usb_close(client);
|
usb_close(client);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Found unknown device");
|
|
||||||
usb_close(client);
|
usb_close(client);
|
||||||
*stage = STAGE_ERROR;
|
*stage = STAGE_RESET;
|
||||||
break; // err
|
continue; // unknown mode, just reloop
|
||||||
}
|
}
|
||||||
|
|
||||||
reloop:
|
reloop:
|
||||||
@@ -313,7 +325,7 @@ int exploit(int *stage)
|
|||||||
|
|
||||||
int exploit(int *stage)
|
int exploit(int *stage)
|
||||||
{
|
{
|
||||||
LOG("Waiting for devices...");
|
LOG("Waiting for DFU mode devices...");
|
||||||
|
|
||||||
struct DeviceConfiguration deviceConfig;
|
struct DeviceConfiguration deviceConfig;
|
||||||
struct PayloadConfiguration payloadConfig;
|
struct PayloadConfiguration payloadConfig;
|
||||||
|
|||||||
Reference in new issue
Block a user