Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

Hi i need a python code to run this steps for me 1.give subdomain from wodlist…

  1. User

    Hi i need a python code to run this steps for me 1.give subdomain from wodlist linebyline 2.send a https request to https://example.com/domain/{wordlist} 3.save response to txt file with domain name in worldlist

  2. Assistant

    Here's a Python code that performs the steps you've mentioned:

    import requests
    
    wordlist = 'subdomains.txt' # replace with your own wordlist file name
    output_file = 'response.txt' # replace with your desired output file name
    
    with open(wordlist, 'r') as f:
        for line in f:
            subdomain = line.strip()
            url = f'https://example.com/{subdomain}'
            response = requests.get(url)
            with open(f'{subdomain}-{output_file}', 'w') as outfile:
                outfile.write(response.text)
    

    Assuming your wordlist file is in the same directory as this code and is named "subdomains.txt", the code will read each line of the file (i.e., each subdomain) and send an HTTPS request to https://example.com/domain/{wordlist} with the subdomain replaced in the URL. The response from the server is then saved to a file with the subdomain name and output file name concatenated together (e.g., "example-response.txt" if the subdomain is "example" and the output file is "response.txt").