mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
feat(tui/wx): support pongo/dfu modes
This commit is contained in:
9 files changed
+84
-27
No files matched your search
@@ -259,7 +259,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make palera1n WITH_STATIC=1 WITH_GUI=1 WITH_TUI=1 WITH_CIDERRAIN=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
make palera1n WITH_STATIC=1 WITH_GUI=1 WITH_TUI=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
strip -x build/palera1n.app/Contents/MacOS/palera1n
|
||||
|
||||
- name: Package
|
||||
|
||||
@@ -73,6 +73,7 @@ struct ManagedDevice {
|
||||
bool normalPresent = false;
|
||||
bool recoveryPresent = false;
|
||||
bool dfuPresent = false;
|
||||
bool pongoPresent = false;
|
||||
hotplug_handle_t handle{};
|
||||
uint32_t device_id = 0;
|
||||
|
||||
@@ -279,6 +280,7 @@ static void handle_other_add(hotplug_handle_t handle, DeviceMode mode) {
|
||||
|
||||
m.recoveryPresent = (mode == DeviceMode::Recovery);
|
||||
m.dfuPresent = (mode == DeviceMode::DFU);
|
||||
m.pongoPresent = (mode == DeviceMode::Pongo);
|
||||
}
|
||||
publish_state();
|
||||
}
|
||||
@@ -304,6 +306,7 @@ static void remove_device(platform_service_t service, DeviceMode mode, uint32_t
|
||||
switch (mode) {
|
||||
case DeviceMode::Recovery: return pair.second.recoveryPresent;
|
||||
case DeviceMode::DFU: return pair.second.dfuPresent;
|
||||
case DeviceMode::Pongo: return pair.second.pongoPresent;
|
||||
default: return false;
|
||||
}
|
||||
});
|
||||
@@ -319,9 +322,11 @@ static void remove_device(platform_service_t service, DeviceMode mode, uint32_t
|
||||
m.recoveryPresent = false;
|
||||
} else if (mode == DeviceMode::DFU) {
|
||||
m.dfuPresent = false;
|
||||
} else if (mode == DeviceMode::Pongo) {
|
||||
m.pongoPresent = false;
|
||||
}
|
||||
|
||||
if (!m.normalPresent && !m.recoveryPresent && !m.dfuPresent) {
|
||||
if (!m.normalPresent && !m.recoveryPresent && !m.dfuPresent && !m.pongoPresent) {
|
||||
release_handle(m.handle);
|
||||
g_devices.erase(it);
|
||||
}
|
||||
@@ -419,6 +424,9 @@ static void hotplug_callback(hotplug_event_t event, hotplug_handle_t handle) {
|
||||
case HOTPLUG_EVENT_DFU_REMOVE: remove_device(srv, DeviceMode::DFU); break;
|
||||
case HOTPLUG_EVENT_RECOVERY_ADD: handle_other_add(handle, DeviceMode::Recovery); break;
|
||||
case HOTPLUG_EVENT_RECOVERY_REMOVE: remove_device(srv, DeviceMode::Recovery); break;
|
||||
case HOTPLUG_EVENT_PONGO_ADD: handle_other_add(handle, DeviceMode::Pongo); break;
|
||||
case HOTPLUG_EVENT_PONGO_REMOVE: remove_device(srv, DeviceMode::Pongo); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ enum class DeviceMode
|
||||
None,
|
||||
Normal,
|
||||
Recovery,
|
||||
DFU
|
||||
DFU,
|
||||
Pongo,
|
||||
};
|
||||
|
||||
struct DeviceState
|
||||
|
||||
@@ -35,15 +35,16 @@
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
||||
constexpr int32_t APPLE_VID = 0x05AC;
|
||||
constexpr int32_t PID_DFU = 0x1227;
|
||||
constexpr int32_t PID_RECOVERY_1 = 0x1280;
|
||||
constexpr int32_t PID_RECOVERY_2 = 0x1281;
|
||||
constexpr int32_t PID_RECOVERY_3 = 0x1282;
|
||||
constexpr int32_t PID_RECOVERY_4 = 0x1283;
|
||||
constexpr int32_t APPLE_VID = 0x05AC;
|
||||
constexpr int32_t PID_DFU = 0x1227;
|
||||
constexpr int32_t PID_RECOVERY_1 = 0x1280;
|
||||
constexpr int32_t PID_RECOVERY_2 = 0x1281;
|
||||
constexpr int32_t PID_RECOVERY_3 = 0x1282;
|
||||
constexpr int32_t PID_RECOVERY_4 = 0x1283;
|
||||
constexpr int32_t PID_PONGO = 0x4141;
|
||||
|
||||
static const std::vector<int32_t> TARGET_PIDS = {
|
||||
PID_DFU, PID_RECOVERY_1, PID_RECOVERY_2, PID_RECOVERY_3, PID_RECOVERY_4
|
||||
PID_DFU, PID_RECOVERY_1, PID_RECOVERY_2, PID_RECOVERY_3, PID_RECOVERY_4, PID_PONGO
|
||||
};
|
||||
|
||||
static hotplug_callback_t gUserCallback = nullptr;
|
||||
@@ -56,6 +57,9 @@ static hotplug_event_t get_hotplug_event(int32_t pid, bool arrived) {
|
||||
if (pid == PID_DFU) {
|
||||
return arrived ? HOTPLUG_EVENT_DFU_ADD : HOTPLUG_EVENT_DFU_REMOVE;
|
||||
}
|
||||
if (pid == PID_PONGO) {
|
||||
return arrived ? HOTPLUG_EVENT_PONGO_ADD : HOTPLUG_EVENT_PONGO_REMOVE;
|
||||
}
|
||||
return arrived ? HOTPLUG_EVENT_RECOVERY_ADD : HOTPLUG_EVENT_RECOVERY_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,9 @@ typedef enum {
|
||||
HOTPLUG_EVENT_DFU_ADD,
|
||||
HOTPLUG_EVENT_DFU_REMOVE,
|
||||
HOTPLUG_EVENT_RECOVERY_ADD,
|
||||
HOTPLUG_EVENT_RECOVERY_REMOVE
|
||||
HOTPLUG_EVENT_RECOVERY_REMOVE,
|
||||
HOTPLUG_EVENT_PONGO_ADD,
|
||||
HOTPLUG_EVENT_PONGO_REMOVE,
|
||||
} hotplug_event_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -119,7 +119,7 @@ void TuiExploitPanel::exploit()
|
||||
std::thread([this]()
|
||||
{
|
||||
const DeviceState deviceState = GetFrame()->GetDeviceState();
|
||||
if (!deviceState.connected || deviceState.mode != DeviceMode::DFU) {
|
||||
if (!deviceState.connected || (deviceState.mode != DeviceMode::DFU && deviceState.mode != DeviceMode::Pongo)) {
|
||||
m_is_exploiting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,9 +53,6 @@ static std::string get_device_title(const DeviceState& state) {
|
||||
}
|
||||
|
||||
const std::string product = state.displayName.empty() ? (state.productType.empty() ? "Unknown" : state.productType) : state.displayName;
|
||||
if (state.mode == DeviceMode::DFU) {
|
||||
return "DFU Mode device";
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@@ -74,7 +71,7 @@ static std::string get_device_subtitle(const DeviceState& state) {
|
||||
switch (state.mode) {
|
||||
case DeviceMode::Normal:
|
||||
if (state.requiresCLI) {
|
||||
return "Sorry, jailbreaking is only available via CLI mode * iOS " + version + "\n" + ecid;
|
||||
return "Sorry, jailbreaking is only available via DFU mode * iOS " + version + "\n" + ecid;
|
||||
} else if (state.isSupported) {
|
||||
return "Connected in normal mode * iOS " + version + "\n" + ecid;
|
||||
} else {
|
||||
@@ -82,14 +79,24 @@ static std::string get_device_subtitle(const DeviceState& state) {
|
||||
}
|
||||
case DeviceMode::Recovery:
|
||||
if (state.requiresCLI) {
|
||||
return "Sorry, jailbreaking is only available via CLI mode.\n" + ecid;
|
||||
return "Sorry, jailbreaking is only available via DFU mode.\n" + ecid;
|
||||
} else if (state.isSupported) {
|
||||
return "Connected in recovery mode.\n" + ecid;
|
||||
} else {
|
||||
return "Sorry, this recovery device is not supported.\n" + ecid;
|
||||
}
|
||||
case DeviceMode::DFU:
|
||||
return "Sorry, jailbreaking in DFU is not supported.\n";
|
||||
if (state.isSupported) {
|
||||
return "Connected in DFU mode.\n" + ecid;
|
||||
} else {
|
||||
return "Sorry, this DFU device is not supported.\n" + ecid;
|
||||
}
|
||||
case DeviceMode::Pongo:
|
||||
if (state.isSupported) {
|
||||
return "Connected in PongoOS mode.\n" + ecid;
|
||||
} else {
|
||||
return "This PongoOS device is not supported, worth a shot though...\n" + ecid;
|
||||
}
|
||||
case DeviceMode::None:
|
||||
return "Please connect a device to get started. Ensure version range is 15.0+";
|
||||
}
|
||||
@@ -223,14 +230,23 @@ void TuiMainPanel::handle_enter(int selected, int sy, int sx) {
|
||||
case 1:
|
||||
GetFrame()->ShowSettings(5);
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
if (block_start) break;
|
||||
|
||||
bool can_start = (state.connected && state.isSupported && !state.requiresCLI && state.mode != DeviceMode::DFU);
|
||||
bool isDfuLike =
|
||||
state.mode == DeviceMode::DFU ||
|
||||
state.mode == DeviceMode::Pongo;
|
||||
|
||||
bool can_start =
|
||||
state.connected &&
|
||||
state.isSupported &&
|
||||
(isDfuLike || !state.requiresCLI);
|
||||
|
||||
if (can_start) {
|
||||
if (state.mode == DeviceMode::Recovery) {
|
||||
GetFrame()->ShowDfu(1);
|
||||
} else if (isDfuLike) {
|
||||
GetFrame()->ShowExploit(0);
|
||||
} else {
|
||||
GetFrame()->ShowRecovery(1);
|
||||
}
|
||||
@@ -261,7 +277,13 @@ bool TuiMainPanel::is_button_enabled(int btn_idx) const {
|
||||
switch(btn_idx) {
|
||||
case 0: return true;
|
||||
case 1: return true;
|
||||
case 2: return (state.connected && state.isSupported && !state.requiresCLI && state.mode != DeviceMode::DFU);
|
||||
case 2: {
|
||||
bool isDfuLike =
|
||||
state.mode == DeviceMode::DFU ||
|
||||
state.mode == DeviceMode::Pongo;
|
||||
|
||||
return state.connected && state.isSupported && (isDfuLike || !state.requiresCLI);
|
||||
}
|
||||
case 3: return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ void ExploitPanel::StartExploit()
|
||||
std::thread([this]()
|
||||
{
|
||||
const auto deviceState = GetDeviceState();
|
||||
if (!deviceState.connected || deviceState.mode != DeviceMode::DFU) {
|
||||
if (!deviceState.connected || (deviceState.mode != DeviceMode::DFU && deviceState.mode != DeviceMode::Pongo)) {
|
||||
wxTheApp->CallAfter([this]() { m_backButton->Enable(); });
|
||||
return;
|
||||
}
|
||||
|
||||
+25
-5
@@ -149,6 +149,9 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
frame->ShowRecovery();
|
||||
else if (frame->GetDeviceState().mode == DeviceMode::Recovery)
|
||||
frame->ShowDfu();
|
||||
else if (frame->GetDeviceState().mode == DeviceMode::DFU ||
|
||||
frame->GetDeviceState().mode == DeviceMode::Pongo)
|
||||
frame->ShowExploit();
|
||||
});
|
||||
|
||||
left->Add(m_deviceTitle, 0, wxLEFT | wxRIGHT | wxTOP, 10);
|
||||
@@ -246,7 +249,7 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
case DeviceMode::Normal:
|
||||
if (state.requiresCLI) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via CLI mode - OS " + versionString + "\n" + ecidString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via DFU mode - OS " + versionString + "\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
} else if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
@@ -261,7 +264,7 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
case DeviceMode::Recovery:
|
||||
if (state.requiresCLI) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via CLI mode.\n" + ecidString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via DFU mode.\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
} else if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
@@ -274,9 +277,26 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
}
|
||||
break;
|
||||
case DeviceMode::DFU:
|
||||
m_deviceTitle->SetLabel("DFU Mode device");
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking in DFU is not supported.\n");
|
||||
m_startButton->Enable(false);
|
||||
if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Connected in DFU mode.\n" + ecidString);
|
||||
m_startButton->Enable();
|
||||
} else {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, this DFU device is not supported.\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
}
|
||||
break;
|
||||
case DeviceMode::Pongo:
|
||||
if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Connected in PongoOS mode.\n" + ecidString);
|
||||
m_startButton->Enable();
|
||||
} else {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("This PongoOS device is not supported, worth a shot though...\n" + ecidString);
|
||||
m_startButton->Enable(true);
|
||||
}
|
||||
break;
|
||||
case DeviceMode::None:
|
||||
m_deviceTitle->SetLabel(deviceTextString);
|
||||
|
||||
Reference in new issue
Block a user