Skip to content

Instantly share code, notes, and snippets.

@fblundun
Created October 30, 2015 09:31
Show Gist options
  • Save fblundun/3e79835845f1c8682c11 to your computer and use it in GitHub Desktop.
Save fblundun/3e79835845f1c8682c11 to your computer and use it in GitHub Desktop.
List strings which may appear when a target string is doubly base 64-encoded
#!/usr/bin/python
import base64
import sys
input = sys.argv[1]
def get_combinations(s):
return [base64.urlsafe_b64encode('a'*i + s)[2*i:-4] for i in range(3)]
for x in [get_combinations(intermediate) for intermediate in get_combinations(sys.argv[1])]:
for y in x:
print(y)
@fblundun
Copy link
Author

Sample usage:

grep -rf <(./double_reverse_base64.py search_string) my_directory

@alexanderdean
Copy link

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment