HackingScripts/template.py

59 lines
1.2 KiB
Python
Raw Normal View History

2021-05-31 14:13:01 +02:00
#!/usr/bin/env python
import sys
def generateTemplate(baseUrl):
template = """#!/usr/bin/env python
2021-10-25 17:25:49 +02:00
import os
2021-06-11 12:44:35 +02:00
import sys
2021-05-31 14:13:01 +02:00
import json
2022-01-16 23:40:35 +01:00
import time
2021-06-11 12:44:35 +02:00
import base64
import requests
2021-10-25 17:25:49 +02:00
import subprocess
import urllib.parse
2021-05-31 14:13:01 +02:00
from bs4 import BeautifulSoup
2021-10-25 17:25:49 +02:00
from hackingscripts import util, fileserver, genRevShell
2021-06-11 12:44:35 +02:00
2021-05-31 14:13:01 +02:00
from urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
2021-06-11 12:44:35 +02:00
BASE_URL = "%s" if "LOCAL" not in sys.argv else "http://127.0.0.1:1337"
2021-05-31 14:13:01 +02:00
2021-10-25 17:25:49 +02:00
def request(method, uri, **kwargs):
if not uri.startswith("/") and uri != "":
uri = "/" + uri
client = requests
if "session" in kwargs:
client = kwargs["session"]
del kwargs["session"]
2022-01-16 23:40:35 +01:00
if "allow_redirects" not in kwargs:
kwargs["allow_redirects"] = False
if "verify" not in kwargs:
kwargs["verify"] = False
return client.request(method, BASE_URL + uri, **kwargs)
2021-05-31 14:13:01 +02:00
2021-06-11 12:44:35 +02:00
if __name__ == "__main__":
2021-10-25 17:25:49 +02:00
pass
2021-05-31 14:13:01 +02:00
""" % baseUrl
return template
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: %s <URL>" % sys.argv[0])
exit()
url = sys.argv[1]
if "://" not in url:
url = "http://" + url
template = generateTemplate(url)
print(template)