Guest User

Untitled

a guest
Nov 6th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. No GetPC(), requires ESI=EIP
  2. Assemble with Yasm
  3.  
  4. bits 32
  5. b64decode:
  6.     add esi, b64decode_end - _b64decode
  7.     push    esi
  8.     pop edi
  9. b64_outer:
  10.     push    04
  11.     lodsd
  12.     pop ecx
  13. b64_inner:
  14.     rol eax, 8
  15.     cmp al, '0'
  16.     jnb b64_testchar
  17.     add al, (('/' << 2) + 1) & 0ffh
  18.     shr al, 2 ;because '+' and '/' differ by only 1 bit
  19. b64_testchar:
  20.     add al, 4
  21.     cmp al, 3fh
  22.     jbe b64_store
  23.     sub al, 45h
  24.     cmp al, 19h
  25.     jbe b64_store
  26.     sub al, 6
  27. b64_store:
  28.     shrd    ebx, eax, 6
  29.     loop    b64_inner
  30.     xchg    ebx, eax
  31.     bswap   eax
  32.     stosd
  33.     cmp byte [esi], '+'
  34.     dec edi
  35.     jnb b64_outer
  36. b64decode_end:
  37.     ;append your base64 data here
  38.     ;terminate with printable character less than '+'
Advertisement
Add Comment
Please, Sign In to add comment