FreeCalypso > hg > freecalypso-reveng
diff mot931c/ptydump.c @ 157:9082f3991fe5
mot931c break-in procedure cracked
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 14 May 2014 05:34:37 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mot931c/ptydump.c Wed May 14 05:34:37 2014 +0000 @@ -0,0 +1,37 @@ +#include <sys/types.h> +#include <sys/file.h> +#include <stdio.h> +#include <stdlib.h> + +main(argc, argv) + char **argv; +{ + int fd; + u_char buf[1024]; + int cc, i; + + if (argc != 2) { + fprintf(stderr, "usage: %s pty\n", argv[0]); + exit(1); + } + fd = open(argv[1], O_RDWR); + if (fd < 0) { + perror(argv[1]); + exit(1); + } + for (;;) { + cc = read(fd, buf, sizeof buf); + if (cc < 0) { + perror("read error"); + exit(1); + } + if (cc == 0) { + fprintf(stderr, "read EOF\n"); + exit(1); + } + printf("read %d bytes:", cc); + for (i = 0; i < cc; i++) + printf(" %02X", buf[i]); + putchar('\n'); + } +}