Jump to content
Nytro

Memit

Recommended Posts

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 --

Sursa: https://github.com/liamg/memit

  • Like 1
  • Thanks 1
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...