parent
a3eba05f82
commit
426585d412
14
netrun.py
14
netrun.py
|
@ -29,15 +29,19 @@ def yn(question, options="yn"):
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Securely run a script from the Internet")
|
parser = argparse.ArgumentParser(description="Securely run a script from the Internet")
|
||||||
parser.add_argument("url", help="URL of the script")
|
parser.add_argument("url", help="URL of the script")
|
||||||
|
parser.add_argument("-s", "--skip-pager", action="store_true", help="Skip pager and confirmation; run script immediately")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
url = args.url
|
url = args.url
|
||||||
|
|
||||||
content = requests.get(url).content
|
content = requests.get(url).content
|
||||||
|
|
||||||
launch("less", content)
|
if args.skip_pager:
|
||||||
|
|
||||||
response = yn("Do you want to run this script?")
|
|
||||||
if response == "y":
|
|
||||||
launch("bash", content)
|
launch("bash", content)
|
||||||
else:
|
else:
|
||||||
print("Script not run.")
|
launch("less", content)
|
||||||
|
|
||||||
|
response = yn("Do you want to run this script?")
|
||||||
|
if response == "y":
|
||||||
|
launch("bash", content)
|
||||||
|
else:
|
||||||
|
print("Script not run.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user