Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;// ------------------------------------------------------------------------------
- ;// THE BEER-WARE LICENSE (Revision 43):
- ;// <aaronryool@gmail.com> wrote this file. As long as you retain this notice you
- ;// can do whatever you want with this stuff. If we meet some day, and you think
- ;// this stuff is worth it, you can buy me a beer in return
- ;// ------------------------------------------------------------------------------
- ; for a full write up on this, go here:
- ; https://www.hackthissite.org/forums/viewtopic.php?f=156&t=12300&p=88305
- [bits 32]
- section .text
- global _start
- org 0x08048000
- ehdr: ; Elf32_Ehdr
- db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident
- times 8 db 0
- dw 2 ; e_type
- dw 3 ; e_machine
- dd 1 ; e_version
- dd _start ; e_entry
- dd phdr - $$ ; e_phoff
- dd 0 ; e_shoff
- dd 0 ; e_flags
- dw ehdrsize ; e_ehsize
- dw phdrsize ; e_phentsize
- dw 1 ; e_phnum
- dw 0 ; e_shentsize
- dw 0 ; e_shnum
- dw 0 ; e_shstrndx
- ehdrsize equ $ - ehdr
- phdr: ; Elf32_Phdr
- dd 1 ; p_type
- dd 0 ; p_offset
- dd $$ ; p_vaddr
- dd $$ ; p_paddr
- dd filesize ; p_filesz
- dd filesize ; p_memsz
- dd 7 ; p_flags
- dd 0x1000 ; p_align
- phdrsize equ $ - phdr
- _start:
- jmp code
- begin:
- pop esi ; pop the address of our data
- mov ecx, 36 ; set loop count to the size of the encrypted data
- xor eax, eax
- xor ebx, ebx
- decode:
- mov al, byte [_start+ebx] ; load character from key into al
- xor byte [esi], al ; xor the key with the encrypted code
- inc esi ; increment our address
- inc ebx ; increment our secondary counter
- loop decode
- jmp hello
- db 0x9c, 0xc8, 0x96, 0x5a, 0xb4, 0x8e, 0x5f ; garbage filler because the key code is smaller than 36 bytes
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; encrypted code:
- code:
- call begin
- hello:
- db 0x00,0x0e,0x07,0x88,0xe4,0x31,0xdb,0x31
- db 0xe3,0x70,0x35,0x68,0x8b,0x31,0x58,0x4d
- db 0x84,0xe3,0x21,0xee,0xac,0xbc,0x1d,0x0b
- db 0x83,0x69,0xf0,0xa4,0xf9,0x7a,0xc3,0xe1
- db 0x2d,0x84,0xb8,0xf5
- ;_start:
- ; jmp hi
- ;main:
- ; pop ecx
- ; xor eax, eax
- ; xor ebx, ebx
- ; xor edx, edx
- ; mov al, 0x4
- ; mov bl, 1
- ; mov dl, 12
- ; int 0x80
- ; jmp end
- ;hi:
- ; call main
- ; db "hello world", 0xa
- ;end:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; exit
- xor ebx, ebx
- xor eax, eax
- inc eax
- int 0x80
- filesize equ $ - $$
Add Comment
Please, Sign In to add comment