Python tip - how to use proxy in exploit code
by Alegron125 - Tuesday April 1, 2025 at 12:55 AM
#1
If you got Python exploit code from somewhere and want to add proxy support for it, for example in order to run it through TOR, please check below.

First, this hint uses requests and argparse libraries so check that your code is using them too:

import requests

import argparse


Next, locate calls to request.head(arguments), request.get(arguments), request.post(arguments), request.put(arguments).
If 'arguments' list does not have 'proxies=<some array>' in it, add it there as below:

result = requests.post(url, headers=headers, proxies=proxies, timeout=timeout, data=payload, verify=False)

Next, locate section for input params and add proxy there too:

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description=help_desc, formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('-H', '--host', default='127.0.0.1', help='host (default: 127.0.0.1)')
    parser.add_argument('-P', '--port', default=80, type=int, help='http port (default: tcp/80)')
    parser.add_argument('-p', '--proxy', help='Use proxy (ex: 127.0.0.1:8080)')
    ... other arguments
    args = parser.parse_args()
   
With this, you can specify proxy as command line argument for this script, and read it into array format that is expected by request methods.
 
  if args.proxy:
        proxies = {
            'http': args.proxy,
            'https': args.proxy,
        }
       
That's the basic idea. Exploit code should now put all http requests through the proxy of your choosing for added privacy.
You can use the following code snippet to check that proxy is working:
 
  test_url = "https://httpbin.org/get" 
    r = requests.get(test_url, proxies=proxies)   
    print('Proxy IP:', r.json()['origin'])
    r = requests.get(test_url)
    print('normal IP:', r.json()['origin'])

   
New guy here, I hope someone finds this useful.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Acunetix 23.7 lolol 37 7,166 Yesterday, 09:37 AM
Last Post: Usercomplex
  [FREE] Database Searcher Telegram odanbtw 1,004 80,262 Apr 24, 2026, 12:13 PM
Last Post: FAKE_NBOBN00
  ✅ Top 10 Google Dorks For SQL Injections NextSoftGroup 9 219 Apr 24, 2026, 02:54 AM
Last Post: elliotalderson4
  [2026] Bypass AV / EDR Spearr 62 771 Apr 24, 2026, 02:44 AM
Last Post: elliotalderson4
  Cardable Giftcard Websites AKASHIC 8 237 Feb 10, 2026, 01:08 PM
Last Post: mreai

Forum Jump:


 Users browsing this forum: 1 Guest(s)