illwill

Shell alias for "base64decode" with auto-padding

Mar 9th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Shell alias for "base64decode" with auto-padding + altchar support by @roman_soft
  2. alias base64decode='python -c "import sys, base64; s = sys.argv[1]; r = len(s) % 4; pad = "A==" if r == 1 else "==" if r == 2 else "=" if r == 3 else ""; s += pad; altchars = "+/" if len(sys.argv) < 3 else sys.argv[2]; sys.stdout.write(base64.b64decode(s, altchars)); sys.stderr.write("[WARN] Incorrect padding!\n" * (1 if r > 0 else 0))"'
Add Comment
Please, Sign In to add comment