kaelscion / slither

A simple, easy to use framework for adding randomized, anonymous IP addresses and user-agents to web scrapers, crawlers, and penetration testing solutions
MIT License
60 stars 10 forks source link

AttributeError #2

Closed Loukious closed 5 years ago

Loukious commented 5 years ago

File "C:\Users\Stan\Desktop\Apps\Mbot\fort.py", line 51, in check result = s.post(url, data=login_data, headers=headers, timeout=10, proxies=choice(new_slither.ips)) File "C:\Python\Python37\lib\site-packages\requests\sessions.py", line 581, in post return self.request('POST', url, data=data, json=json, **kwargs) File "C:\Python\Python37\lib\site-packages\requests\sessions.py", line 524, in request prep.url, proxies, stream, verify, cert File "C:\Python\Python37\lib\site-packages\requests\sessions.py", line 699, in merge_environment_settings no_proxy = proxies.get('no_proxy') if proxies is not None else None AttributeError: 'str' object has no attribute 'get'

kaelscion commented 5 years ago

Hi there! thanks for submitting an issue. Could you post up the code snippet your trying to run, please?

Loukious commented 5 years ago

Hi there! thanks for submitting an issue. Could you post up the code snippet your trying to run, please?

Thanks for the fast reply <3.

def check(userpass): new_slither = Slither(thread_count=1) l_userpassw = userpass.split(':') headers = { 'Authorization': 'basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=', 'User-Agent': 'Fortnite/++Fortnite+Release-7.40-CL-4980899 IOS/12.1.2' } login_data = { "grant_type": "password", "username": l_userpassw[0].strip(), "password": l_userpassw[1].strip(), "includePerms": "true", "token_type": "eg1" } url = "https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token"

with requests.session() as s:
    try:
        result = s.post(url, data=login_data, headers=headers, timeout=10, proxies=choice(new_slither.ips))
        resp = result.json()

And I'm calling this function through th = threading.Thread(target=check, args=[message['message']['text']]) th.start()

kaelscion commented 5 years ago

bugfix just got pushed up! get the latest version and take a look at the readme again. Requests requires a dictionary object for the proxies parameter and I put a string in the example. There also was a bug in the proxy class that did not apply to proxy port number to the IP. That has also been fixed. The Readme now contains a new example that demonstrates correctly passing the proxy parameter with a dictionary. I didn't catch that on testing so that you very very much for bringing this issue to my attention!

Loukious commented 5 years ago

bugfix just got pushed up! get the latest version and take a look at the readme again. Requests requires a dictionary object for the proxies parameter and I put a string in the example. There also was a bug in the proxy class that did not apply to proxy port number to the IP. That has also been fixed. The Readme now contains a new example that demonstrates correctly passing the proxy parameter with a dictionary. I didn't catch that on testing so that you very very much for bringing this issue to my attention!

That issue is gone now. Should I open another ticket to suggest testing the proxy before passing it? Cause not all proxies will be 100% working, some might timeout.

kaelscion commented 5 years ago

this is super true and very relevant as these proxies do go stale pretty quick (which is why we pull them in as often as the framework gets used). No need for another ticket though. My recommendation would be to wrap the requests in a try: except: to try a different proxy on timeout exceptions. Thanks for bringing that up though!

kaelscion commented 5 years ago

Update has been completed to the readme with examples of how to properly perform some error handling with Requests. Thanks again for cluing me in on this! Despite a long career as a Software Dev, this is my first "major" OSS project so any and all help and/or feedback from the community is more than appreciated!