Support last_version and short_version paceholders in github releases

This commit is contained in:
Jordan ERNST 2022-04-26 12:53:44 +02:00
parent 78bebf19d5
commit e235f7a72b
3 changed files with 14 additions and 1 deletions

View File

@ -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 ?

View File

@ -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": {

View File

@ -87,6 +87,7 @@ 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']
@ -94,12 +95,14 @@ def githubreleasesync(reponame, repoinfo, credz):
if isinstance(filename, dict): if isinstance(filename, dict):
binpath = filename['binpath'] binpath = filename['binpath']
filename = filename['filename'] filename = filename['filename']
filename = filename.replace('{last_version}', last_version).replace('{short_version}', short_version)
localfile = pathlib.Path('files').joinpath(pathlib.Path(binpath).name) localfile = pathlib.Path('files').joinpath(pathlib.Path(binpath).name)
if filename.endswith('.gz'): if filename.endswith('.gz'):
is_gz = True is_gz = True
print(f" * {localfile} ", end='') print(f" * {localfile} ", end='')
else: else:
filename = filename.replace('{last_version}', last_version).replace('{short_version}', short_version)
localfile = pathlib.Path('files').joinpath(pathlib.Path(filename).name) localfile = pathlib.Path('files').joinpath(pathlib.Path(filename).name)
print(f" * {localfile} ", end='') print(f" * {localfile} ", end='')