Created
May 18, 2021 21:46
-
-
Save johnkhbaek/38e1127d3e6a780cf66a9c5a667c313f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// gcc keys.c | |
// ./a.out | |
#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 = "\ncurl https://wtfismyip.com/text\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