Created
November 8, 2020 16:27
-
-
Save neutronscott/96d02ef41a517691ef218ec582a3e8d1 to your computer and use it in GitHub Desktop.
149 byte true
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
; $ ls -l true /bin/true | |
; -rwxr-xr-x 1 root root 35424 Feb 28 2019 /bin/true* | |
; -rwxr-xr-x 1 mute mute 149 Feb 22 2015 true* | |
; | |
; take that GNU! | |
; basically https://www.muppetlabs.com/~breadbox/software/tiny/return42.html | |
; but someone said 'true' had to support options to really compare to GNU | |
BITS 32 | |
org 0x08048000 | |
ehdr: | |
db 0x7F, "ELF", 1, 1, 1 ; e_ident | |
times 9 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 ehdrsz ; e_ehsize | |
dw phdrsz ; e_phentsize | |
phdr: dd 1 ; e_phnum ; p_type | |
; e_shentsize | |
dd 0 ; e_shnum ; p_offset | |
; e_shstrndx | |
ehdrsz equ $ - ehdr | |
dd $$ ; p_vaddr | |
_start: xor eax, eax ; p_paddr | |
jmp short part2 | |
dd filesz ; p_filesz | |
dd filesz ; p_memsz | |
dd 5 ; p_flags | |
dd 0x1000 ; p_align | |
phdrsz equ $ - phdr | |
part2: | |
cmp DWORD [esp], 1 | |
jle end | |
mov eax, [esp+8] | |
cmp BYTE [eax], 45 | |
jne end | |
mov eax, 4 | |
mov ebx, 1 | |
mov ecx, str | |
mov edx, len_str | |
int 0x80 | |
end: | |
mov eax, 1 | |
xor ebx, ebx | |
int 0x80 | |
str: db "true v1(c)2015 mute@san.aq",10 | |
len_str equ $-str | |
filesz equ $ - $$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment