Skip to content

Instantly share code, notes, and snippets.

@marz-hunter
Created August 2, 2024 12:02
Show Gist options
  • Save marz-hunter/2c3a924389b28337bb45b0bc33f22bef to your computer and use it in GitHub Desktop.
Save marz-hunter/2c3a924389b28337bb45b0bc33f22bef to your computer and use it in GitHub Desktop.
import requests
# Step 1: Get the initial buildId from the first request
response1 = requests.get('https://immunefi.com/bug-bounty/')
response1.raise_for_status() # Ensure we got a successful response
# Find the buildId in the response body
start_index = response1.text.find('"buildId":"') + len('"buildId":"')
end_index = response1.text.find('"', start_index)
build_id = response1.text[start_index:end_index]
# Step 2: Use the buildId to get the list of bug bounty ids
url2 = f'https://immunefi.com/_next/data/{build_id}/bug-bounty.json'
response2 = requests.get(url2)
response2.raise_for_status()
bounties_data = response2.json()
# Extract the ids from the response
ids = [bounty['id'] for bounty in bounties_data['pageProps']['bounties']]
# Step 3: For each id, get the URLs of type "websites_and_applications"
urls = []
for bounty_id in ids:
url3 = f'https://immunefi.com/_next/data/{build_id}/bug-bounty/{bounty_id}/scope.json?slug={bounty_id}'
response3 = requests.get(url3)
response3.raise_for_status()
scope_data = response3.json()
for asset in scope_data['pageProps']['bounty']['assets']:
if asset['type'] == 'websites_and_applications':
urls.append(asset['url'])
# Print the collected URLs
for url in urls:
print(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment