client, sandbox_test: Make things toggleable via F10 instead of just being launchable

This commit is contained in:
Perttu Ahola 2014-10-14 21:11:20 +03:00
parent 6115d92f3f
commit 9ca7697f7e
2 changed files with 16 additions and 1 deletions

View File

@ -60,11 +60,26 @@ end
-- Enabled when this module is loaded.
-- Normally that happens when KEY_F10 is pressed on the client.
local value_checker_enabled = true
function M.check_value(value)
if not value_checker_enabled then return end
log:debug("sandbox_test.check_value()")
try_exploit.search_single_value(value)
end
__buildat_sandbox_debug_check_value_sub(M.check_value)
local is_active = false
function M.toggle() -- Called by client/app
if not is_active then
M.run()
value_checker_enabled = true
is_active = true
else
value_checker_enabled = false
is_active = false
end
end
return M
-- vim: set noet ts=4 sw=4:

View File

@ -537,7 +537,7 @@ struct CApp: public App, public magic::Application
"if type(m) ~= 'table' then\n"
" error('Failed to load extension "+extname+"')\n"
"end\n"
"m.run()\n";
"m.toggle()\n";
if(!run_script_no_sandbox(script)){
log_e(MODULE, "Failed to load and run extension %s", cs(extname));
}