payload

package module
v0.0.0-...-06bf3cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 6 Imported by: 4

README

About

This tool allows you to ship a single executable without the need for extra resource files. Using the provided command line tool you can append a data file to the end of your executable which should leave it intact to be run by the OS. The library then gives you a function to read the data back in from the end of the new executable. This way there is no need to pack your files or create an installer, you can just ship a single executable.

Usage

Install the tool and library by running

go get -u github.com/gonutz/payload/...

To then combine an executable and a data file, run:

payload -exe=path/to/exe -data=path/to/data -output=path/for/combined/exe

If you leave out the output paramter, the original executable is overwritten.

In the executable file you can add code to read the data back in as a []byte slice, here is an example program that just reads the payload and prints its contents to stdout:

package main

import (
	"fmt"
	"github.com/gonutz/payload"
)

func main() {
	data, err := payload.Read()
	if err != nil {
		panic(err)
	}
	fmt.Printf("%s", data)
}

Documentation

Here is the Godoc for the library.

The command line tool payload is used as follows:

Usage of payload:
  -data string
        Data file to be appended to the executable.
  -exe string
        Executable file to append data to.
  -output string
        Combined output file, defaults to the input exe.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read() ([]byte, error)

Read reads the whole payload at once, returning it as a byte slice.

Types

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

func Open

func Open() (ReadSeekCloser, error)

Open opens the payload for reading. Call Close on the returned ReadSeekCloser after you are done with it.

Directories

Path Synopsis
cmd
payload
This program appends a data file to an executable file to create another executable file.
This program appends a data file to an executable file to create another executable file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL