SHARE
TWEET

sed-url-encoder.sh

h8rt3rmin8r Jan 10th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. #------------------------------------------------------------------------------#
  3. ##  URL ENCODER - (Built entirely with 'sed' and 'tr' pipelines)
  4. ##  Created by h8rt3rmin8r on 20190110
  5. #------------------------------------------------------------------------------#
  6.  
  7. INPUT="$1"
  8.  
  9. if [[ "x$1" == "x" ]];
  10. then
  11.     echo "ERROR: No input detected!"
  12. fi
  13.  
  14. echo "${INPUT}" \
  15.     | sed 's/%/%25/g' | sed 's/\ /%20/g' | sed 's/</%3C/g' | sed 's/>/%3E/g' \
  16.     | sed 's/#/%23/g' | sed 's/{/%7B/g' | sed 's/}/%7D/g' | sed 's/|/%7C/g' \
  17.     | sed 's/\\/%5C/g' | sed 's/\^/%5E/g' | sed 's/~/%7E/g' | sed 's/\[/%5B/g' \
  18.     | sed 's/\]/%5D/g' | sed 's/`/%60/g' | sed 's/;/%3B/g' | sed 's/\//%2F/g' \
  19.     | sed 's/?/%3F/g' | sed 's/\:/%3A/g' | sed 's/@/%40/g' | sed 's/=/%3D/g' \
  20.     | sed 's/&/%26/g' | sed 's/\$/%24/g' | sed 's/\!/%21/g' | sed 's/\*/%2A/g' \
  21.     | tr '(' '#' | tr ')' '&' | sed 's/#/%28/g' | sed 's/&/%29/g'
  22.    
  23. #------------------------------------------------------------------------------#
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top