Fix download method

This commit is contained in:
Jordan ERNST 2022-08-09 14:07:02 +02:00
parent 89450cd2fe
commit b9790c7d9f
2 changed files with 13 additions and 10 deletions

View File

@ -29,15 +29,19 @@
], ],
"InitRoot/SweetPotato": [ "InitRoot/SweetPotato": [
"SweetPotato.exe" "SweetPotato.exe"
],
"PowerShellMafia/PowerSploit": [
"Recon/PowerView.ps1"
] ]
}, },
"githubreleasesync": { "githubreleasesync": {
"carlospolop/PEASS-ng": { "carlospolop/PEASS-ng": {
"local_version": "20220731", "local_version": "20220807",
"files": [ "files": [
"linpeas.sh", "linpeas.sh",
"winPEAS.bat", "winPEAS.bat",
"winPEASany.exe" "winPEASany.exe",
"winPEASany_ofs.exe"
] ]
}, },
"jpillora/chisel": { "jpillora/chisel": {

View File

@ -5,7 +5,6 @@ import json
from pathlib import Path from pathlib import Path
import hashlib import hashlib
import requests import requests
import base64
import sys import sys
from os import geteuid, chdir from os import geteuid, chdir
import subprocess import subprocess
@ -29,8 +28,8 @@ def get_master_info(repo, filepath, credz):
url = f"https://api.github.com/repos/{repo}/contents/{filepath}" url = f"https://api.github.com/repos/{repo}/contents/{filepath}"
r = requests.get(url, auth=credz) r = requests.get(url, auth=credz)
sha = r.json()['sha'] sha = r.json()['sha']
content = r.json()['content'] dlurl = r.json()['download_url']
return sha, content return sha, dlurl
def get_last_release_info(repo, credz): def get_last_release_info(repo, credz):
@ -69,12 +68,12 @@ def githubmastersync(reponame, filepaths, credz):
for filepath in filepaths: for filepath in filepaths:
localfile = Path('files').joinpath(Path(filepath).name) localfile = Path('files').joinpath(Path(filepath).name)
print(f" * {localfile} ", end='') print(f" * {localfile} ", end='')
lastsha, content = get_master_info(reponame, filepath, credz) lastsha, dlurl = get_master_info(reponame, filepath, credz)
if not localfile.exists(): if not localfile.exists():
content = base64.b64decode(content) r = requests.get(dlurl)
with open(localfile, 'wb') as f: with open(localfile, 'wb') as f:
f.write(content) f.write(r.content)
print('-> Installed! ;)') print('-> Installed! ;)')
else: else:
@ -83,9 +82,9 @@ def githubmastersync(reponame, filepaths, credz):
if sha == lastsha: if sha == lastsha:
print('-> Up-to-date.') print('-> Up-to-date.')
else: else:
content = base64.b64decode(content) r = requests.get(dlurl)
with open(localfile, 'wb') as f: with open(localfile, 'wb') as f:
f.write(content) f.write(r.content)
print('-> Updated!') print('-> Updated!')