howmuch515 icon

calculator.asm

howmuch515 | PRO | 01/12/20 11:32:30 AM UTC | 0 ⭐ | 12936 👁️ | Never ⏰ | []
ASM (NASM) |

0 B

|

None

|

0 👍

/

0 👎

BITS 64
 
global start
 
section .text
 
start:
    ; \x48\x31\xd2\x52\x48\xbf\x6c\x63\x75\x6c\x61\x74\x6f\x72\x57\x48\xbf\x61\x63\x4f\x53\x2f\x2f\x43\x61\x57\x48\xbf\x74\x65\x6e\x74\x73\x2f\x2f\x4d\x57\x48\xbf\x2e\x61\x70\x70\x2f\x43\x6f\x6e\x57\x48\xbf\x6c\x63\x75\x6c\x61\x74\x6f\x72\x57\x48\xbf\x74\x69\x6f\x6e\x73\x2f\x43\x61\x57\x48\xbf\x2f\x41\x70\x70\x6c\x69\x63\x61\x57\x48\x89\xe7\x52\x57\x48\x89\xe6\x48\x31\xc0\xb0\x02\x48\xc1\xc8\x28\xb0\x3b\x0f\x05
    ; execve("/Applications/Calculator.app/Contents//MacOS//Calculator",
    ;        {"/Applications/Calculator.app/Contents//MacOS//Calculator", NULL},
    ;        NULL)
 
    ; rdx = 0
    xor     rdx, rdx
 
    ; rdi = "/Applications/Calculator.app/Contents//MacOS//Calculator"
    push    rdx
    mov     rdi, 0x726f74616c75636c
    push    rdi
    mov     rdi, 0x61432f2f534f6361
    push    rdi
    mov     rdi, 0x4d2f2f73746e6574
    push    rdi
    mov     rdi, 0x6e6f432f7070612e
    push    rdi
    mov     rdi, 0x726f74616c75636c
    push    rdi
    mov     rdi, 0x61432f736e6f6974
    push    rdi
    mov     rdi, 0x6163696c7070412f
    push    rdi
    mov     rdi, rsp
 
    ; rsi = {"/Applications/Calculator.app/Contents//MacOS//Calculator", NULL}
    push    rdx
    push    rdi
    mov     rsi, rsp
 
    ; store syscall number on RAX
    xor     rax,rax                 ;zero out RAX
    mov     al,2                    ;put 2 to AL -> RAX = 0x0000000000000002
    ror     rax, 0x28               ;rotate the 2 -> RAX = 0x0000000002000000
    mov     al,0x3b                 ;move 3b to AL (execve SYSCALL#) -> RAX = 0x000000000200003b
    syscall                         ;trigger syscall

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎