feat(cli): add ra1n dfu-helper for cli

supports going from recovery to dfu, only.
This commit is contained in:
C committed 2026-09-17 19:28:01 -07:00
1 parent af06958989
commit 8a47c8ce8a
1 file changed
+18 -6
+18 -6
View File
@@ -132,7 +132,7 @@ const char* err_to_string(int err) {
int exploit(int *stage)
{
LOG("Waiting for devices...");
LOG("Waiting for DFU mode devices...");
*stage = STAGE_RESET;
@@ -158,7 +158,20 @@ int exploit(int *stage)
if (!usb_get_client_flag(client, &flag))
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) {
// we cant do shit sorry
LOG_ERROR("Found an unknown pwned DFU mode device");
@@ -273,10 +286,9 @@ int exploit(int *stage)
usb_close(client);
continue;
} else {
LOG_ERROR("Found unknown device");
usb_close(client);
*stage = STAGE_ERROR;
break; // err
*stage = STAGE_RESET;
continue; // unknown mode, just reloop
}
reloop:
@@ -313,7 +325,7 @@ int exploit(int *stage)
int exploit(int *stage)
{
LOG("Waiting for devices...");
LOG("Waiting for DFU mode devices...");
struct DeviceConfiguration deviceConfig;
struct PayloadConfiguration payloadConfig;