Guest User

Untitled

a guest
Jun 13th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2.         filename: db 'testdir',7 ;name of the new dir
  3.         string: db 'Hello',5 ;string to write to file..
  4.         stringLen: equ $-string ;length of string
  5.         textfile: db 'hello.txt',9 ;textfile to write string to..
  6.  
  7. section .text
  8.         global _start
  9.  
  10. _start:
  11.        ;Creating directory..
  12.         mov eax, 39 ;mkdir sys-call
  13.         mov ebx, filename ;copy filename into first arg of mkdir syscall
  14.         mov ecx, 00644Q ;rw_rw_rw in octal  
  15.  
  16.         int 80h ;call the kernel..
  17.  
  18.         ;cd to the created dir..
  19.        ;ebx still contains the filename
  20.         mov eax, 12 ;chdir syscall
  21.         int 80h; ;now inside the create dir
  22.  
  23.         ;Create a file
  24.        ;ecx still contains the perms in octal
  25.         mov eax, 8
  26.         mov ebx, textfile;
  27.  
  28.         ; Exit the prog..
  29.         mov eax, 1;
  30.         mov ebx, 0;
  31.  
  32.         int 80h;
Add Comment
Please, Sign In to add comment