Guest User

Untitled

a guest
Jan 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <linux/input.h>
  3. #include <linux/uinput.h>
  4. #include <sys/types.h>
  5. #include <sys/stat.h>
  6. #include <fcntl.h>
  7. #include <unistd.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10.  
  11. char translate(int code)
  12. {
  13. if (code >= 16 && code <= 25) {
  14. return "qwertyuiop"[code - 16];
  15. }
  16. if (code >= 30 && code <= 38) {
  17. return "asdfghjkl"[code - 30];
  18. }
  19. if (code >= 44 && code <= 50) {
  20. return "zxcvbnm"[code - 44];
  21. }
  22. return '\0';
  23. }
  24. int main(int argc, char *argv[])
  25. {
  26. int i, fd;
  27. struct input_event ev;
  28.  
  29. srand(0);
  30. printf("Google Chrome process found, PID: 12907\n");
  31. printf("Injecting exploit into target process "); fflush(stdout);
  32. for (i = 0 ; i < 4 ; i++) {
  33. printf("."); fflush(stdout);
  34. usleep(1000000);
  35. }
  36. printf(" success!\n");
  37. printf("Base target address: %p\n", &ev);
  38. fd = open("/dev/input/event14", O_RDONLY);
  39. if (fd < 0) {
  40. fprintf(stderr, "cannot open input\n");
  41. return 1;
  42. }
  43. while (1) {
  44. int ret = read(fd, &ev, sizeof(ev));
  45. if (ret != sizeof(ev)) {
  46. fprintf(stderr, "unexpected read count\n");
  47. continue;
  48. }
  49. if (ev.type == EV_KEY && ev.value == 1) {
  50. printf("Malicious read at %lx (success) -> char:%c\n", 0xffffffff00000000 + rand(), translate(ev.code));
  51. }
  52. }
  53. return 0;
  54. }
Add Comment
Please, Sign In to add comment