All Projects â†’ liamg â†’ memit

liamg / memit

Licence: Unlicense license
🚫💾 Run binaries straight from memory in Linux

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to memit

memfd-examples
Sample usage of the new memfd_create(2) Linux system call.
Stars: ✭ 64 (-71.17%)
Mutual labels:  memfd

Memit

Execute a binary from memory, without touching the disk. Linux only.

Available as both a Go module and a binary.

demo

Using the Go module

The Command() method takes an io.Reader, so you can use it with things like an HTTP response body, a bytes.Buffer, etc.

It provides an *exec.Cmd (via memit.Command(...)) so you can wire up stdin/out and configure other parameters just like you would with a regular command.

package main

import "github.com/liamg/memit"

func main() {
	resp, _ := http.Get("https://.../mybinary")

	cmd, _, _ := memit.Command(resp.Body, "--args", "--go", "--here")

	cmd.Stderr = os.Stderr
	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout

	_ = cmd.Run()
}

Using the binary

Grab the latest release and run it like this:

memit https://.../mybinary -- # args for the actual binary can be put after the --
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].