b64decode.py: A Base64 Decoder

##################################################################
# Python script to decode base64 input (file or standard input). #
#                                                                #
# Usage:                                                         #
#   python b64decode.py [<filename>]                             #
#                                                                #
#   Will decode <filename>. If no filename is given, then the    #
#   script will read from standard input.                        #
#   Decoded output will be written to standard output.           #
#                                                                #
#                                                                #
# b64decode.py v2015.01.17                                       #
# https://malwaremusings.com/supporting-files/b64decode-py/       #
##################################################################


import sys
import base64

if (len(sys.argv) > 1):
        f = open(sys.argv[1],"r")
else:
        f = sys.stdin

d = f.read()
f.close()

print base64.b64decode(d)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s