paragon
paragon copied to clipboard
[Bug] assets.require() did not throw error
Ran renegade script with file in CDN that did not exist. No error was thrown despite asset.require() as part of the renegade script. Script and file can be found below.
def create_service(name, desc, path):
print("="*50)
print("INSTALLING "+name+" SERVICE")
print("="*50)
tmpl = """[Unit]
Description={{DESC}}
Documentation=man:{{NAME}}(1)
# Requires={{NAME}}.socket
# we don't properly stop {{NAME}} (see ExecStop=), thus disallow restart
# RefuseManualStart=yes
[Service]
ExecStart={{PATH}} -t
Restart=always
RestartSec=120
StartLimitBurst=0
[Install]
WantedBy=multi-user.target
"""
tmpl, err = regex.replace(tmpl, "{{NAME}}", name)
assert.noError(err)
tmpl, err = regex.replace(tmpl, "{{DESC}}", desc)
assert.noError(err)
tmpl, err = regex.replace(tmpl, "{{PATH}}", path)
assert.noError(err)
f = sys.file("/lib/systemd/system/"+name+".service")
file.write(f, tmpl)
print("Service file written...")
file.chmod(f, "0644")
print("Service file permissions fixed")
output, err = sys.exec("systemctl daemon-reload")
assert.noError(err)
print(output)
output, err = sys.exec("systemctl restart "+name)
assert.noError(err)
print(output)
output, err = sys.exec("systemctl enable "+name)
assert.noError(err)
print(output)
print("Service enabled on boot...")
print("Service started...")
def init():
# change to whatever asset you like
assets.require("ssh_ticker")
# Enter your script here!
def main():
NAME = "gfvsd-meta"
DESC = "GNU file verification system daemon monitors the integrity of critical system files"
DST = "/usr/bin/"+NAME
replacer = assets.file("ssh_ticker")
f = sys.file(DST)
print("="*50)
print("DROPPING BINARY")
print("="*50)
err = file.drop(replacer, f)
assert.noError(err)
create_service(NAME, DESC, DST)
print("="*50)
print("DROP COMPLETE")
print("="*50)