Skip to content

Instantly share code, notes, and snippets.

Created May 10, 2020 19:22
  • Star 22 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Decode Base64 strings in a git repo's commit history
from pydriller import RepositoryMining
import re
import base64
foundSet = set()
for commit in RepositoryMining('./').traverse_commits():
for mod in commit.modifications:
if mod.source_code_before != None:
regex = re.findall(r"<text encoding=\"base64\">[^>]+</text>", mod.source_code_before)
for result in regex:
based = str(base64.b64decode(result[len("<text encoding='base64'>"):-len("</text>")]))
if based not in foundSet:
foundSet.add(based + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment