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
|
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"]
|
|
|
|
|
|
|
|
return client.request(method, BASE_URL + uri, verify=False, allow_redirects=False, **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)
|