Tuesday, August 26, 2008

HeX 021: Decode base64

There are a lot of malicious contents which are actually encoded with base64 to create confusion.

This is just quick one as I have friend asking about it on how to decode base64 encoding. One liner with python -

shell>python -c "import binascii; \
binascii.a2b_base64('encoded strings here')


Or you can use nsm console if you are running HeX -

nsm>decode base64 'encoded strings here'

Enjoy ;]

2 comments:

  1. You can do this without binascii as well.

    $ python -c 'print "Encode this string".encode("base64")'
    RW5jb2RlIHRoaXMgc3RyaW5n

    $ python -c 'print "RW5jb2RlIHRoaXMgc3RyaW5n".decode("base64")'
    Encode this string

    ReplyDelete
  2. my lame method:

    $ echo "stings"|base64
    c3RpbmdzCg==

    $ echo "c3RpbmdzCg=="|base64 -d
    stings

    ReplyDelete