feat(tui): support for showing errors for exploit

This commit is contained in:
CLARATION committed 2026-07-22 19:30:34 -07:00
1 parent 6dbc791c07
commit ef16aa0659
2 files changed
+26 -7

No files matched your search

+25 -5
View File
@@ -125,11 +125,13 @@ void TuiExploitPanel::exploit()
}
auto stage = std::make_shared<std::atomic<int>>(STAGE_RESET);
auto result = std::make_shared<std::atomic<int>>(0);
std::thread worker([stage]()
std::thread worker([stage, result]()
{
::exploit(reinterpret_cast<int*>(stage.get()));
stage->store(STAGE_DONE);
int ret = ::exploit(reinterpret_cast<int*>(stage.get()));
result->store(ret);
stage->store(ret == 0 ? STAGE_DONE : STAGE_ERROR);
});
for (;;)
@@ -137,15 +139,33 @@ void TuiExploitPanel::exploit()
int currentStage = stage->load();
int progress = stage_to_progress(currentStage);
if (currentStage == STAGE_ERROR) {
const char* error = err_to_string(result->load());
set_status(
std::string(stage_to_string(currentStage)) +
" (" +
error +
")",
0
);
break;
}
set_status(stage_to_string(currentStage), progress);
if (currentStage == STAGE_DONE) break;
if (currentStage == STAGE_DONE)
break;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
if (worker.joinable()) worker.join();
if (worker.joinable())
worker.join();
m_is_exploiting = false;
}).detach();
}
+1 -2
View File
@@ -145,9 +145,8 @@ void ExploitPanel::StartExploit()
m_statusText->SetLabel(stage_to_string(currentStage));
m_progressBar->SetValue(progress);
if (currentStage == STAGE_DONE) {
if (currentStage == STAGE_DONE)
m_backButton->Enable();
}
});
if (currentStage == STAGE_DONE || currentStage == STAGE_ERROR)