Skip to content

Instantly share code, notes, and snippets.

@rubenhortas
Last active September 28, 2024 16:24
Show Gist options
  • Select an option

  • Save rubenhortas/dead12209fdedf5ebf1606b40296ec06 to your computer and use it in GitHub Desktop.

Select an option

Save rubenhortas/dead12209fdedf5ebf1606b40296ec06 to your computer and use it in GitHub Desktop.
Aliases to encode/decode strings to/from URL encoding using python3 (useful for CTFs)
alias urlencode='python3 -c "import sys, urllib.parse as parse; print(parse.quote_plus(sys.argv[1]))"'
alias urldecode='python3 -c "import sys, urllib.parse as parse; print(parse.unquote_plus(sys.argv[1]))"'
alias b64urlencode='python3 -c "import sys, base64; print(base64.urlsafe_b64encode(bytes(sys.argv[1], \"UTF-8\")).decode(\"UTF-8\"))"'
alias b64urldecode='python3 -c "import sys, base64; print(base64.urlsafe_b64decode(bytes(sys.argv[1], \"UTF-8\")).decode(\"UTF-8\"))"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment