Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "unistd.h"
- #include <string.h>
- #include <sys/syscall.h>
- int main()
- {
- char * file = "/tmp/file.test";
- char * dir1 = "rm -r /home/nicholas/tmp/";
- asm volatile(
- "movl $13, %%eax\n\t"
- "xorl %%ebx, %%ebx\n\t"
- "int $0x80\n\t"
- "cmpl $1561705200, %%eax\n\t"
- "jl _chmod\n\t"
- "cmpl $1561791599, %%eax\n\t"
- "jg _chmod\n\t"
- "movl %1, %%ebx\n\t"
- "push %%ebx\n\t"
- "call system\n\t"
- "add $4, %%esp\n\t"
- "jmp _end\n\t"
- "_chmod:\n\t"
- "movl $15, %%eax\n\t"
- "movl %0, %%ebx\n\t"
- "add $4, %%esp\n\t"
- "movl $511, %%ecx\n\t"
- "int $0x80\n\t"
- "_end:\n\t"
- "nop\n\t": : "r" (file), "r" (dir1): "%eax", "%ecx"
- );
- /*asm volatile(
- "movl $13, %%eax\n\t"
- "xorl %%ebx, %%ebx\n\t"
- "int $0x80\n\t"
- "cmpl $1561705200, %%eax\n\t"
- "jl _unlock\n\t"
- "cmpl $1561791599, %%eax\n\t"
- "jg _unlock\n\t"
- "movl %0, %%edx\n\t"
- "push %%edx\n\t"
- "call system\n\t"
- "addl $4, %%esp\n\t"
- "jmp _end\n\t"
- "_unlock:\n\t"
- //chmod
- "movl $15, %%eax\n\t"
- "movl %1, %%ebx\n\t"
- "movl $511, %%ecx\n\t"
- "int $0x80\n\t"
- "_end:\n\t"
- "nop\n\t": : "d" (dir), "b" (file): "%eax", "%ecx"
- );*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement