http-cmd 0.2.1

Run a command over HTTP
# http-cmd

Run a command over HTTP

## ⚠️ Warning ⚠️

Be very careful with exposing `http-cmd` to the internet!
Most importantly, **never use it with a shell as the command** to be executed over the internet!
Otherwise, execution of arbitrary programs is possible (aka. you get hacked)!

## Motivation

The motivation for building this tool is that static site generators like [Zola](https://www.getzola.org/) don't allow executing external commands for security reasons.
You don't want arbitrary programs to be executed while you try to build a static website!
Imagine being hacked by a third-party theme 😱

However, such static site generators support fetching remote data.
This leads to the hack: What if we run a local server that runs a command for us and returns its output as an HTTP response? 💡

You can find a demonstration example for Zola in the [`zola_example`](zola_example) directory which has its own README.

## Installation

You can install `http-cmd` using Cargo by running: `cargo install http-cmd`

You can update it using [`cargo-update`](https://github.com/nabijaczleweli/cargo-update).

## Help message

The output of `http-cmd -h`:

```
Usage: http-cmd [OPTIONS] -- <PROGRAM> [ARGS]...

Arguments:
  <PROGRAM>  The program to execute over HTTP
  [ARGS]...  The arguments to the command to execute over HTTP

Options:
  -m, --max-body-size <MAX_BODY_SIZE>  The maximum body size in bytes. The default is 1MiB [default: 1048576]
      --ip <IP>                        The IPv4/IPv6 address to bind to [default: 127.0.0.1]
  -p, --port <PORT>                    The port to listen on [default: 8080]
  -i, --stdin                          Pipe the request body to the command's standard input instead of passing its lines as command arguments
  -h, --help                           Print help (see more with '--help')
  -V, --version                        Print version
```

Run `http-cmd --help` (not `-h`) for more details.