mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
14 lines
301 B
Rust
14 lines
301 B
Rust
|
|
//! Phase 17 (Track L.15) — rocket benign control fixture.
|
||
|
|
|
||
|
|
use rocket::get;
|
||
|
|
use std::process::Command;
|
||
|
|
|
||
|
|
#[get("/run?<cmd>")]
|
||
|
|
pub fn run(cmd: String) -> &'static str {
|
||
|
|
let allow = ["ls", "ps"];
|
||
|
|
if allow.contains(&cmd.as_str()) {
|
||
|
|
let _ = Command::new(&cmd).status();
|
||
|
|
}
|
||
|
|
"ok"
|
||
|
|
}
|