Skip to content
/ elfexec Public

Utility to execute ELF binary directly from stdin pipe.

Notifications You must be signed in to change notification settings

abbat/elfexec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elfexec

Utility to execute ELF binary directly from stdin pipe. It is useful to run binary via SSH without copy or install it on remote systems.

Examples

Run binary via ssh:

$ cat build-1234 | ssh user@host 'elfexec --test=integration --env=production'

Decode base64 encoded binary and run it directly:

$ echo 'IyEvYmluL3NoCmVjaG8gIkhlbGxvISIK' | base64 -d | elfexec

Compile source code and run it without temporary files:

$ echo '
#include <unistd.h>

int main(int argc, char* argv[])
{
    write(STDOUT_FILENO, "Hello!\n", 7);
    return 0;
}
' | cc -xc - -o /dev/stdout | elfexec

Download / Install

Require Linux 3.17 or higher:

$ git clone https://github.com/abbat/elfexec.git
$ make && sudo make install

To compile with own flags use USER_CFLAGS and USER_LDFLAGS variables. For example for i386 static binary with musl libc:

$ CC=musl-gcc32 USER_CFLAGS=-m32 USER_LDFLAGS='-m32 -static -Wl,-melf_i386' make

Usage

elfexec [options]

Where options is executed binary options.

Exit code

Executed binary exit code or 1 if self failed.

How to help

  • Translate this document or man page to your native language;
  • Proofreading README.md or man page with your native language;
  • Share, Like, RT to your friends;
  • Send PRs if you are developer.