Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; A hello world for encrypted binary obfuscation
- ; Brought to you by MadMouse
- ; Play like this:
- ; nasm -f elf64 hello.s -o hello.o
- ; ld -N hello.o -o hello
- [bits 64]
- section .text
- global _start
- _start:
- call main
- ; key data
- db 0x7b,0xcb,0xdd,0x3e,0xbe,0x0b,0x43,0xb4,0x99,0x6b,0xa7,0xbe
- db 0x0e,0x27,0x26,0xb0,0xdb,0x98,0xea,0x86,0xdf,0x20,0x68,0x15
- db 0x2f,0x9b,0x4e,0x5c,0x04,0x39,0x20,0x03,0xdb,0xa5,0x7c,0xcb
- db 0xa8,0x22
- ; encrypted code:
- db 0x93,0xc7,0xdd,0x3e,0xbe,0x63,0x26,0xd8,0xf5,0x04,0x87,0xc9
- db 0x61,0x55,0x4a,0xd4,0xd1,0xc6,0x5a,0xd8,0x6f,0x21,0x28,0x9d
- db 0xe8,0x29,0x42,0x53,0x01,0x89,0x1c,0x4b,0xea,0x5a,0x73,0xce
- db 0xa8,0x09
- main:
- pop rsi ; pop the address of our data
- mov cl, 38 ; set loop count to the size of the encrypted data
- decode:
- mov al, byte [rsi] ; load character from key into al
- xor byte [rsi+38], al ; xor the key with the encrypted code
- inc rsi ; increment our address
- loop decode
- jmp rsi ; jump into our decrypted code :D
Advertisement
Add Comment
Please, Sign In to add comment