mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 17:57:01 +02:00
feat: wxWidgets gui
This commit is contained in:
53 files changed
+2494
-296
No files matched your search
@@ -0,0 +1,72 @@
|
||||
#ifdef WITH_GUI
|
||||
|
||||
#include "ExploitPanel.hpp"
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "AppFrame.hpp"
|
||||
#include "DevicePanel.hpp"
|
||||
#include "../state.hpp"
|
||||
#include "../utils/log.h"
|
||||
|
||||
ExploitPanel::ExploitPanel(MainFrame* frame, wxWindow* parent)
|
||||
: DevicePanel(frame, parent)
|
||||
{
|
||||
auto* root = new wxBoxSizer(wxVERTICAL);
|
||||
auto* text = new wxStaticText(this, wxID_ANY,
|
||||
"Installing jailbreak, this will take a moment. If the device asks for a passcode\nplease enter it. Do not disconnect the device until finished.");
|
||||
|
||||
m_statusText = new wxStaticText(this, wxID_ANY, "");
|
||||
|
||||
root->Add(text, 0, wxALL, 10);
|
||||
root->Add(m_statusText, 0, wxALL, 10);
|
||||
|
||||
m_backButton = new wxButton(this, wxID_ANY, "Back");
|
||||
m_backButton->Disable();
|
||||
m_backButton->Bind(wxEVT_BUTTON, [frame](wxCommandEvent&)
|
||||
{
|
||||
frame->ShowMain();
|
||||
});
|
||||
|
||||
auto* bottomRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
bottomRow->AddStretchSpacer();
|
||||
bottomRow->Add(m_backButton, 0, wxALL, 10);
|
||||
|
||||
root->AddStretchSpacer();
|
||||
root->Add(bottomRow, 0, wxEXPAND);
|
||||
|
||||
SetSizer(root);
|
||||
}
|
||||
|
||||
void ExploitPanel::SetDeviceState(const DeviceState& state)
|
||||
{
|
||||
DevicePanel::SetDeviceState(state);
|
||||
|
||||
if (!(this->IsShown()))
|
||||
return;
|
||||
|
||||
if (state.mode == DeviceMode::Normal)
|
||||
{
|
||||
m_statusText->SetLabel("Done.");
|
||||
m_backButton->Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void ExploitPanel::StartExploit()
|
||||
{
|
||||
m_statusText->SetLabel("Exploiting device...");
|
||||
m_backButton->Disable();
|
||||
|
||||
std::thread([this]()
|
||||
{
|
||||
const auto state = GetDeviceState();
|
||||
if (!state.connected || state.mode != DeviceMode::DFU)
|
||||
return;
|
||||
|
||||
LOG("Starting exploit on worker thread...");
|
||||
}).detach();
|
||||
}
|
||||
|
||||
#endif // WITH_GUI
|
||||
Reference in new issue
Block a user