Skip to content

Instantly share code, notes, and snippets.

@s0md3v
Last active March 6, 2024 22:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0md3v/747b815cddcb2c9c4c7d0232bcc676ec to your computer and use it in GitHub Desktop.
Save s0md3v/747b815cddcb2c9c4c7d0232bcc676ec to your computer and use it in GitHub Desktop.
google magika bypass
#def _tokenize(code, comments, comment_strings, containers):
# """
# tokenizes sources code to find hardcoded strings
# returns list of hardcoded strings
# """
# string = container = comment_end = ''
# state = 'look'
# skip = 0
# comment = False
# all_strings = []
# for index, char in enumerate(code):
# if skip > 0:
# skip -= 1
# continue
# buff = code[index:index+4]
# if comment:
# if buff.startswith(comment_end):
# skip = len(comment_end)
# if comments == 'string' and string:
# all_strings.append(string)
# state = 'look'
# comment = False
# string = container = ''
# continue
# elif not comment and state == 'look':
# started = _if_comment_started(buff, comment_strings)
# if started:
# string = ''
# state = 'look'
# comment = True
# comment_end = started[0]
# skip = started[1] - 1
# continue
# if comment:
# if comments == 'string':
# string += char
# continue
# elif comments == 'ignore':
# continue
# if char in containers:
# if state == 'look':
# state = 'store'
# container = char
# elif state == 'store' and char == container and not _is_escaped(code[:index]):
# if string:
# all_strings.append(string)
# string = ''
# state = 'look'
# else:
# string += char
# elif state == 'store':
# string += char
# return all_strings
# print("""
Write-Output "Powershell will print this!"
# """)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment