Skip to content

Instantly share code, notes, and snippets.

@forensicmatt
Created April 8, 2020 02:51
Show Gist options
  • Save forensicmatt/35a9138f4cc91840191c59d1c1e16232 to your computer and use it in GitHub Desktop.
Save forensicmatt/35a9138f4cc91840191c59d1c1e16232 to your computer and use it in GitHub Desktop.
Install all the win64 executables in the l2tbinaries github folder
import os
import requests
import tempfile
import subprocess
import json
def main():
win64_request = requests.get("https://api.github.com/repos/log2timeline/l2tbinaries/contents/win64")
contents = json.loads(win64_request.text)
for file_info in contents:
_, extension = os.path.splitext(file_info['name'])
binary_file = tempfile.NamedTemporaryFile(mode="w+b", delete=False, suffix=extension)
binary_blob = requests.get(file_info['download_url']).content
binary_file.write(binary_blob)
binary_file.close()
binary_full_path = binary_file.name
print("Downloaded {} -> {}".format(file_info['name'], binary_full_path))
if extension.lower() == ".msi":
cmd = [binary_full_path, '/quiet', '/norestart']
print("cmd: {}".format(cmd))
install_proc = subprocess.Popen(cmd, shell=True)
install_proc.wait()
elif extension.lower() == ".exe":
subprocess.Popen([binary_full_path], shell=True)
install_proc.wait()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment