Skip to content

Commit

Permalink
cross-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
qqzero0 authored Nov 14, 2023
1 parent 78b1986 commit 824094d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from typing import List

def main() -> None:
if platform.system() != "Windows":
exit()
diretorio_appdata = os.getenv('LOCALAPPDATA') if platform.system() == "Windows" else (os.path.expanduser('~/Library/Application Support') if platform.system() == "Darwin" else os.path.expanduser('~'))

diretorio_appdata = os.getenv('LOCALAPPDATA')
if diretorio_appdata is None:
return

Expand All @@ -19,7 +17,7 @@ def main() -> None:
for arquivo_js in arquivos_js:
if contem_token_mfa(arquivo_js):
print(f'[!] Possible token grabber in {arquivo_js}, opening...')
subprocess.run(f"notepad.exe {arquivo_js}")
abrir(arquivo_js)
encontrou = True
if not encontrou:
print('[!] No suspicious file was found.')
Expand All @@ -39,5 +37,19 @@ def contem_token_mfa(arquivo_js: str) -> bool:
conteudo = f.read()
return 'mfa.' in conteudo

def abrir(arquivo: str) -> None:
if platform.system() == "Windows":
subprocess.run(["notepad.exe", arquivo])
elif platform.system() == "Darwin":
try:
subprocess.run(["open", "-t", arquivo])
except:
subprocess.run(["nano", arquivo])
elif platform.system() == "Linux":
try:
subprocess.run(["xdg-open", arquivo])
except:
subprocess.run(["vim", arquivo])

if __name__ == '__main__':
main()

0 comments on commit 824094d

Please sign in to comment.