-
-
Save cephurs/f5ae73e77a3ec694650e07a158ec7d7c to your computer and use it in GitHub Desktop.
Install all the win64 executables in the l2tbinaries github folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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