#include "runner.h" #include "base64.h" #include #include void print_usage() { std::cerr << "Usage: runner BASE64COMMAND" << std::endl; std::cerr << " where BASE64COMMAND is a Base64 encoded JSON string" << std::endl; } int main(int argc, char* argv[]) { if (argc != 2) { print_usage(); return 1; } std::string base64_command = argv[1]; std::string json_string; try { // Decode Base64 json_string = base64_decode(base64_command); } catch (const std::exception& e) { std::cerr << "Error decoding Base64: " << e.what() << std::endl; return 1; } // Parse JSON nlohmann::json run_json; try { run_json = nlohmann::json::parse(json_string); } catch (const nlohmann::json::parse_error& e) { std::cerr << "Error parsing JSON: " << e.what() << std::endl; return 1; } // Execute command bool success = dropshell::Runner::run(run_json); // Return the exit code return success ? 0 : 1; }