The Burp Suite User Forum was discontinued on the 1st November 2024.

Burp Suite User Forum

For support requests, go to the Support Center. To discuss with other Burp users, head to our Discord page.

SUPPORT CENTER DISCORD

change the Upstream Proxy Port

Chim | Last updated: Oct 26, 2023 05:45AM UTC

Is there a way to use a script to change the Upstream Server Proxy? I tried to use Rest API but I can't find any document regarding it. Can you please help me to provide the end point for my script below: import urllib2 import json def set_upstream_proxy(port): # Define the API endpoint and proxy details api_url = "http://127.0.0.1:1337/v0.1/options/upstreamProxy/servers" proxy_details = { "protocol": "http", "address": "rotating-residential.geonode.com", "port": port } # Prepare the request req = urllib2.Request(api_url, json.dumps(proxy_details)) req.add_header('Content-Type', 'application/json') req.get_method = lambda: 'PUT' # Make the API call to update the upstream proxy settings try: response = urllib2.urlopen(req) result = response.read() print(result) except urllib2.HTTPError as e: print("Error:", e.code, e.reason) print(e.read()) def get_next_port(): # Specify the absolute path to the file file_path = "/home/kali/Downloads/last_port.txt" # Adjust this path as needed # Read the last port from the file try: with open(file_path, "r") as f: last_port = int(f.read().strip()) except: last_port = 10000 # Default starting port minus 1 # Calculate the next port next_port = last_port + 1 if next_port > 10250: next_port = 10001 # Save the next port to the file with open(file_path, "w") as f: f.write(str(next_port)) return next_port # Call the function with the next port port_to_set = get_next_port() set_upstream_proxy(port_to_set)

Ben, PortSwigger Agent | Last updated: Oct 26, 2023 12:07PM UTC

Hi, The Burp REST API is fairly limited in functionality and there are only three endpoints available. Being able to configure the Upstream Proxy is something that is only available when using the Burp UI so you would not be able to script this in the manner in which you are trying to do.

Chim | Last updated: Oct 26, 2023 06:00PM UTC

I am trying to look into Burp Extender API but didn't see any function to modify the Upstream Server Port. Do you have any suggestion that I can automatically rotate the Upstream Proxy Port? Thanks

Chim | Last updated: Oct 26, 2023 06:00PM UTC

I am trying to look into Burp Extender API but didn't see any function to modify the Upstream Server Port. Do you have any suggestion that I can automatically rotate the Upstream Proxy Port? Thanks

Ben, PortSwigger Agent | Last updated: Oct 27, 2023 10:01AM UTC

Just to confirm, what do you mean by automatically rotate and how often would you be looking to change the port? This option is saved within the user/project options configurations so it is possible to load Burp with different configuration files but it would entirely depend on how frequently you are wanting to alter this?

Chim | Last updated: Oct 28, 2023 01:58AM UTC

I want to the port to rotate from the beginning of the session for each payload (including session macros).

Chim | Last updated: Oct 28, 2023 02:00AM UTC

I have a list of Proxy with different ip addresses and ports. I would like to have it rotate at every new session started before each payload.

Ben, PortSwigger Agent | Last updated: Oct 30, 2023 02:05PM UTC

Hi, By carrying this out what is your overall goal? We do not quite understand why you would want to alter the port of the upstream proxy server for each payload and what this would help you achieve.

Chim | Last updated: Nov 09, 2023 09:58AM UTC

I am using the a third party proxy server to change the ip address. By changing the port, it would change the ip address for each payload since the target website is having a ip rate limits.

Michelle, PortSwigger Agent | Last updated: Nov 09, 2023 11:25AM UTC

Hi Just to clarify, if a different port is used for the upstream proxy, does this mean the Proxy server's IP address is translated to a different external IP as the traffic is routed to the internet? How many different ports/IPs are in your list? When you reach the end of the list, would you start back with the first one again?

Chim | Last updated: Nov 17, 2023 08:37PM UTC

Yes, when the port change, it would change the ip addresses. There is 1000 ports/IP on the list. When reaching the end of the list, it would go back to first one again.

Ben, PortSwigger Agent | Last updated: Nov 21, 2023 11:40AM UTC