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