Struct inapi::Payload [] [src]

pub struct Payload { /* fields omitted */ }

Payloads are self-contained projects that encapsulate a specific feature or system function.

Think of them as reusable chunks of code that can be run across multiple hosts. Any time you have a task that you want to repeat, or a package you want to install/configure it should probably go into a payload.

Examples

For example, a payload could handle installing a specific package, such as Nginx. Or, you could create a payload that checks your security logs for signs of a break in.

let payload = Payload::new("nginx::install").unwrap(); // format is "payload::executable"
payload.run(&mut host, None).unwrap();

Methods

impl Payload
[src]

[src]

Create a new Payload using the payload::artifact notation. This notation is simply "payload" + separator ("::") + "executable/source file". For example: "nginx::install".

By default, payloads live in <project root>/payloads/<payload_name>. Thus the payload name "nginx" will resolve to <project root>/payloads/nginx/. You can also specify an absolute path to your payload, which will override the resolved path.

// Using standard payload/artifact notation...
let payload = Payload::new("iptables::update").unwrap();

// Using an absolute path...
let payload = Payload::new("/mnt/intecture/payloads/iptables::update").unwrap();

[src]

Compile a payload's source code. This function is also called by run(), but is useful for precompiling payloads ahead of time to catch build errors early.

Note that this is only useful for compiled languages. If this function is run on a payload that uses an interpreted language, it will safely be ignored.

[src]

Build and execute the payload's artifact.

For compiled languages, the artifact will be executed directly. For interpreted languages, the artifact will be passed as an argument to the interpreter.

 let payload = Payload::new("iptables::configure").unwrap();
 payload.run(&mut host, Some(vec![
     "add_rule",
     "..."
 ])).unwrap();