Crate boxxy

Crate boxxy 

Source
Expand description

This crate provides an interactive shell that can be used to provide a basic debugger for sandboxes. It features a couple of builtin commands to test eg. file access when external programs can’t be used (chroots or seccomp).

It also accepts custom functions that can be included to step through various stages of your sandbox.

§Example

#[macro_use] extern crate boxxy;

fn stage1(sh: &mut boxxy::Shell, args: Vec<String>) -> Result<(), boxxy::Error> {
    shprintln!(sh, "init stage 1! {:?}", args);
    // your code here
    Ok(())
}

fn stage2(sh: &mut boxxy::Shell, args: Vec<String>) -> Result<(), boxxy::Error> {
    shprintln!(sh, "init stage 2! {:?}", args);
    // your code here
    Ok(())
}

fn main() {
    env_logger::init();

    let toolbox = boxxy::Toolbox::new().with(vec![
            ("stage1", stage1),
            ("stage2", stage2),
        ]);
    boxxy::Shell::new(toolbox).run()
}

Re-exports§

pub use crate::ctrl::Interface;
pub use crate::shell::Command;
pub use crate::shell::ForeignCommand;
pub use crate::shell::NativeCommand;
pub use crate::shell::Shell;
pub use crate::shell::Toolbox;

Modules§

busybox
Builtin commands.
completer
ctrl
errors
ffi
Abstractions of some unsafe functions.
shell
The interactive shell.

Macros§

shprintln

Structs§

Error
The Error type, a wrapper around a dynamic error type.

Type Aliases§

Arguments
Arguments passed to builtin commands
Result
Result<T, Error>