Compare commits
No commits in common. "92ad9bfa6bcd8d0b66a980b1912982c81d9aa358" and "a3eba05f82d65343252bb6f085f0957e919d027e" have entirely different histories.
92ad9bfa6b
...
a3eba05f82
|
@ -1,5 +1,3 @@
|
||||||
echo -n 'User: '
|
|
||||||
whoami
|
whoami
|
||||||
echo
|
|
||||||
echo '`ls -l`:'
|
|
||||||
ls -l
|
ls -l
|
||||||
|
touch testfile
|
||||||
|
|
29
netrun.py
29
netrun.py
|
@ -27,32 +27,17 @@ def yn(question, options="yn"):
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
interpreter = ["bash"]
|
|
||||||
pager = ["less"]
|
|
||||||
|
|
||||||
content = requests.get(url).content
|
content = requests.get(url).content
|
||||||
|
|
||||||
if args.skip_pager:
|
launch("less", content)
|
||||||
launch(interpreter, content)
|
|
||||||
else:
|
|
||||||
launch(pager, content)
|
|
||||||
|
|
||||||
response = yn("Do you want to run this script?")
|
response = yn("Do you want to run this script?")
|
||||||
if response == "y":
|
if response == "y":
|
||||||
launch(interpreter, content)
|
launch("bash", content)
|
||||||
else:
|
else:
|
||||||
print("Script not run.")
|
print("Script not run.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user