Compare commits
No commits in common. "e235f7a72b28494d74b5ea0fed5a6e1575bd9117" and "36c46920ec35a69ced6562a9897bf6c73314de45" have entirely different histories.
e235f7a72b
...
36c46920ec
@ -6,7 +6,6 @@ This too has several functions:
|
||||
|
||||
## To-Do
|
||||
|
||||
* Auto-clean files/tmp/ folder
|
||||
* Prettier code
|
||||
* Only update once per day, except if `-u` `--update`
|
||||
* Adding more services to listen to ?
|
||||
|
11
config.json
11
config.json
@ -19,21 +19,12 @@
|
||||
},
|
||||
"githubreleasesync": {
|
||||
"carlospolop/PEASS-ng": {
|
||||
"local_version": "20220424",
|
||||
"local_version": "20220417",
|
||||
"files": [
|
||||
"linpeas.sh",
|
||||
"winPEAS.bat",
|
||||
"winPEASany.exe"
|
||||
]
|
||||
},
|
||||
"jpillora/chisel": {
|
||||
"local_version": "v1.7.7",
|
||||
"files": [
|
||||
{
|
||||
"filename": "chisel_{short_version}_windows_amd64.gz",
|
||||
"binpath": "chisel.exe"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ncat": {
|
||||
|
@ -9,7 +9,6 @@ import subprocess
|
||||
from io import BytesIO
|
||||
import zipfile
|
||||
import rpmfile
|
||||
import gzip
|
||||
|
||||
|
||||
def compute_file_hash(filepath):
|
||||
@ -54,9 +53,6 @@ def extract_bin(archtype, binpath, destpath, content):
|
||||
|
||||
with open(destpath, 'wb') as f:
|
||||
f.write(fd.read())
|
||||
elif archtype == 'gz':
|
||||
with open(destpath, 'wb') as f:
|
||||
f.write(gzip.decompress(content))
|
||||
ioobj.close()
|
||||
|
||||
|
||||
@ -87,34 +83,18 @@ def githubmastersync(reponame, filepaths, credz):
|
||||
def githubreleasesync(reponame, repoinfo, credz):
|
||||
local_version = repoinfo['local_version']
|
||||
last_version = get_last_release_info(reponame, credz)
|
||||
short_version = last_version.replace('v', '')
|
||||
|
||||
filenames = repoinfo['files']
|
||||
|
||||
for filename in filenames:
|
||||
if isinstance(filename, dict):
|
||||
binpath = filename['binpath']
|
||||
filename = filename['filename']
|
||||
filename = filename.replace('{last_version}', last_version).replace('{short_version}', short_version)
|
||||
localfile = pathlib.Path('files').joinpath(pathlib.Path(binpath).name)
|
||||
if filename.endswith('.gz'):
|
||||
is_gz = True
|
||||
print(f" * {localfile} ", end='')
|
||||
|
||||
else:
|
||||
filename = filename.replace('{last_version}', last_version).replace('{short_version}', short_version)
|
||||
localfile = pathlib.Path('files').joinpath(pathlib.Path(filename).name)
|
||||
print(f" * {localfile} ", end='')
|
||||
|
||||
localfile = pathlib.Path('files').joinpath(pathlib.Path(filename).name)
|
||||
urldl = f'https://github.com/{reponame}/releases/download/{last_version}/{filename}'
|
||||
print(f" * {localfile} ", end='')
|
||||
|
||||
if not localfile.exists():
|
||||
content = requests.get(urldl, auth=credz).content
|
||||
if is_gz:
|
||||
extract_bin('gz', binpath, localfile, content)
|
||||
else:
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
|
||||
print('-> Installed! ;)')
|
||||
else:
|
||||
@ -123,11 +103,8 @@ def githubreleasesync(reponame, repoinfo, credz):
|
||||
|
||||
else:
|
||||
content = requests.get(urldl, auth=credz).content
|
||||
if is_gz:
|
||||
extract_bin('gz', binpath, localfile, content)
|
||||
else:
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
with open(localfile, 'wb') as f:
|
||||
f.write(content)
|
||||
print('-> Updated!')
|
||||
|
||||
with open("config.json", "r") as jsonfile:
|
||||
|
Loading…
x
Reference in New Issue
Block a user