Fix download method
This commit is contained in:
parent
89450cd2fe
commit
b9790c7d9f
@ -29,15 +29,19 @@
|
||||
],
|
||||
"InitRoot/SweetPotato": [
|
||||
"SweetPotato.exe"
|
||||
],
|
||||
"PowerShellMafia/PowerSploit": [
|
||||
"Recon/PowerView.ps1"
|
||||
]
|
||||
},
|
||||
"githubreleasesync": {
|
||||
"carlospolop/PEASS-ng": {
|
||||
"local_version": "20220731",
|
||||
"local_version": "20220807",
|
||||
"files": [
|
||||
"linpeas.sh",
|
||||
"winPEAS.bat",
|
||||
"winPEASany.exe"
|
||||
"winPEASany.exe",
|
||||
"winPEASany_ofs.exe"
|
||||
]
|
||||
},
|
||||
"jpillora/chisel": {
|
||||
|
@ -5,7 +5,6 @@ import json
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import requests
|
||||
import base64
|
||||
import sys
|
||||
from os import geteuid, chdir
|
||||
import subprocess
|
||||
@ -29,8 +28,8 @@ def get_master_info(repo, filepath, credz):
|
||||
url = f"https://api.github.com/repos/{repo}/contents/{filepath}"
|
||||
r = requests.get(url, auth=credz)
|
||||
sha = r.json()['sha']
|
||||
content = r.json()['content']
|
||||
return sha, content
|
||||
dlurl = r.json()['download_url']
|
||||
return sha, dlurl
|
||||
|
||||
|
||||
def get_last_release_info(repo, credz):
|
||||
@ -69,12 +68,12 @@ def githubmastersync(reponame, filepaths, credz):
|
||||
for filepath in filepaths:
|
||||
localfile = Path('files').joinpath(Path(filepath).name)
|
||||
print(f" * {localfile} ", end='')
|
||||
lastsha, content = get_master_info(reponame, filepath, credz)
|
||||
lastsha, dlurl = get_master_info(reponame, filepath, credz)
|
||||
|
||||
if not localfile.exists():
|
||||
content = base64.b64decode(content)
|
||||
r = requests.get(dlurl)
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
f.write(r.content)
|
||||
print('-> Installed! ;)')
|
||||
|
||||
else:
|
||||
@ -83,9 +82,9 @@ def githubmastersync(reponame, filepaths, credz):
|
||||
if sha == lastsha:
|
||||
print('-> Up-to-date.')
|
||||
else:
|
||||
content = base64.b64decode(content)
|
||||
r = requests.get(dlurl)
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
f.write(r.content)
|
||||
print('-> Updated!')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user