Skip to content

Instantly share code, notes, and snippets.

0xef967c36

Block or report user

Report or block 0xef967c36

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@0xef967c36
0xef967c36 / herestring.c
Last active Mar 26, 2019
simple wrapper which will execute a command with its stdin redirected from a string
View herestring.c
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
#include <err.h>
int main(int ac, char **av){
int fd; size_t len;
if(ac < 3) errx(1, "usage %s string cmd [args ...]", av[0]);
if((fd = syscall(SYS_memfd_create, av[0], 0)) == -1)
err(1, "memfd_create");
@0xef967c36
0xef967c36 / pexec.c
Last active Jan 6, 2019
exec binary or shebanged script from a pipe in Linux by using memfd_create
View pexec.c
#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <err.h>
int main(int ac, char **av){
int fd; ssize_t l; char *dav[] = { "pexec", "run-by-pexec", 0 };
if(ac < 2) av = dav;
if((fd = syscall(SYS_memfd_create, av[0], 0)) == -1)
err(1, "memfd_create");
You can’t perform that action at this time.