Oussama Hamad
Oussama Hamad

Reputation: 81

requests.exceptions.InvalidURL: Failed to parse

I think my code is clean and simple , but i got this error :

requests.exceptions.InvalidURL: Failed to parse: http://support
.google.com/

When trying to run it .

I don't know why actually i tried too many things

when i change

fuzing_website_response = requests.get(f'http://{i}.{take_input}/')

to

fuzing_website_response = requests.get(f'http://{take_input}/{i}')

and run it and with valid URL input _ > it will give me the responses status_code successfully .

But the other code which try to enumerate subdomains given me the provided error even when http://support.google.com is a valid url

Detailed response with the reason of the problem will be appreciated.

Script code :






take_input = input('Enter the website > ')
take_file = open('list.txt','r')


for i in take_file:
    fuzing_website_response = requests.get(f'http://{i}.{take_input}/')
    print (f'{take_input}/{i} ---> {fuzing_website_response.status_code}')

Upvotes: 8

Views: 20436

Answers (1)

Yagiz Degirmenci
Yagiz Degirmenci

Reputation: 20668

This is actually something with the urllib3 library because requests parses the url with urllib3, urllib3's parser isn't percent-encoding characters within the userinfo section of the URL, just upgrade your urllib3 it will work.

How to upgrade or install ?

python -m pip install --upgrade urllib3

pip install urllib3

from github repository:

git clone git://github.com/urllib3/urllib3.git
cd urllib3
python setup.py install

Upvotes: 13

Related Questions