Run scripts from the Internet more securely than `curl | bash` (experimental)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import requests
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
url = sys.argv[1]
|
|
|
|
|
|
|
|
content = requests.get(url).content
|
|
|
|
|
|
|
|
subprocess.run(["less"], input=content)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
response = (
|
|
|
|
input("Do you want to run this script? [y/n] ").lower().strip()[0]
|
|
|
|
)
|
|
|
|
if response == "y":
|
|
|
|
subprocess.run(["bash"], input=content)
|
|
|
|
break
|
|
|
|
elif response == "n":
|
|
|
|
print("Script not run.")
|
|
|
|
break
|