Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active March 3, 2017 06:03
Show Gist options
  • Save intrd/d1ce0e54ce8177383c2b1a9ad289e3c7 to your computer and use it in GitHub Desktop.
Save intrd/d1ce0e54ce8177383c2b1a9ad289e3c7 to your computer and use it in GitHub Desktop.
Caesar base64(rotn) visual bruteforce
## Caesar base64(rotn) visual bruteforce
# @author intrd - http://dann.com.br/
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
import base64, string
def caesar_int(ch, shift):
n = ord(ch)
if ord('a') <= n <= ord('z'):
n = n - ord('a')
n = (n + shift) % 26
n = n + ord('a')
return chr(n)
elif ord('A') <= n <= ord('Z'):
n = n - ord('A')
n = (n + shift) % 26
n = n + ord('A')
return chr(n)
else:
return ch
def caesar(s, shift):
return ''.join(caesar_int(ch, shift) for ch in s)
for x in range(0, 40):
try:
print(base64.b64decode(caesar('Xxxxxxxxxxxxxxxxxxxxxx==',x)))
except Exception:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment