Skip to content

Instantly share code, notes, and snippets.

@sudhackar
Created November 28, 2018 18:26
Show Gist options
  • Save sudhackar/cde1a434b355b2b03394b9d3d9c36568 to your computer and use it in GitHub Desktop.
Save sudhackar/cde1a434b355b2b03394b9d3d9c36568 to your computer and use it in GitHub Desktop.
pwnadventure sourcery lab2 csaw ctf 2018 finals
section .text
global _start
_start:
mov eax, 3
mov ebx, 0
mov ecx, input
mov edx, 5
int 80h
mov esi, input
.checker:
xor edi, edi
mov esi, input
mov edx, 0xfa
mov al, [esi]
rol edx, 5
xor dl, al
add dl, 0xab
mov al, [esi+1]
rol edx, 3
xor dl, al
add dl, 0x45
mov al, [esi+2]
rol edx, 1
xor dl, al
add dl, 0x12
mov al, [esi+3]
rol edx, 9
xor dl, al
add dl, 0xcd
mov cl, dl
and cl, 15
add cl, 'a'
mov [output+edi], cl
inc edi
rol edx, 12
xor dl, cl
add dl, 0x87
mov cl, dl
and cl, 15
add cl, 'a'
mov [output+edi], cl
inc edi
rol edx, 3
xor dl, cl
add dl, 0xef
mov cl, dl
and cl, 15
add cl, 'C'
mov [output+edi], cl
inc edi
rol edx, 1
xor dl, cl
add dl, 0x10
mov cl, dl
and cl, 15
add cl, 'f'
mov [output+edi], cl
inc edi
rol edx, 13
xor dl, cl
add dl, 0x9a
mov cl, dl
and cl, 15
add cl, 'e'
mov [output+edi], cl
inc edi
rol edx, 9
xor dl, cl
add dl, 0xa8
mov cl, dl
and cl, 15
add cl, 'D'
mov [output+edi], cl
inc edi
rol edx, 7
xor dl, cl
add dl, 0xca
mov cl, dl
and cl, 15
add cl, 'D'
mov [output+edi], cl
inc edi
rol edx, 2
xor dl, cl
add dl, 0x91
mov cl, dl
and cl, 15
add cl, 'c'
mov [output+edi], cl
inc edi
rol edx, 5
xor dl, cl
add dl, 0x86
mov cl, dl
and cl, 15
add cl, 'A'
mov [output+edi], cl
inc edi
rol edx, 6
xor dl, cl
add dl, 0xf1
mov cl, dl
and cl, 15
add cl, 'e'
mov [output+edi], cl
inc edi
rol edx, 3
xor dl, cl
add dl, 0x1f
mov cl, dl
and cl, 15
add cl, 'B'
mov [output+edi], cl
inc edi
rol edx, 4
xor dl, cl
add dl, 0x90
mov cl, dl
and cl, 15
add cl, 'f'
mov [output+edi], cl
inc edi
mov eax, 4
mov ebx, 1
mov ecx, output
mov edx, 12
int 80h
jmp .end
.end:
mov eax, 1
mov ebx, 0
int 80h
section .data
input: db 100
output: db 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment