fake-name / xA-Scraper

69 stars 8 forks source link

2Captcha failure #48

Closed God-damnit-all closed 5 years ago

God-damnit-all commented 5 years ago

fAGet is having issues due to a DDOS attack occurring today. I have a 2Captcha API Key, so I thought I'd use that. Unfortunately it did not work.

I had to alter this log slightly to hide my login information.

Setting up loggers....
done
Setup
initialized manager
Creating pool
INFO: Creating engine for process! Engine name: 'MainProcess-MainThread'
Setting up loggers....
done
Setup
initialized manager
fetch args ['fa'] <class 'list'>
ScraperBase Init
Starting up
Starting up?
Creating pool
INFO: Creating engine for process! Engine name: 'MainProcess-MainThread'
Main.WebRequest - INFO - Fetching content at URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - WARNING - Error opening page: http://www.furaffinity.net/controls/user-settings/ at Sun Sep  8 19:29:35 2019 On Attempt 1.
Main.WebRequest - WARNING - Error Code: HTTP Error 503: Service Temporarily Unavailable
Main.WebRequest - WARNING - Original URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - WARNING - Cloudflare failure! Doing automatic step-through.
Main.WebRequest - INFO - Using cloudscraper to attempt to circumvent cloudflare.
Main.WebRequest - INFO - Updating cookie!
Main.WebRequest - INFO - Updating cookie!
Main.WebRequest - INFO - Updating cookie!
Main.WebRequest - INFO - Fetching content at URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - INFO - Request for URL: http://www.furaffinity.net/controls/user-settings/ succeeded at Sun Sep  8 19:29:40 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 5.357K. Decompressed = 15.859K. File type: text/html; charset=UTF-8.
Main.FaGet.StatusMgr - INFO - Do not have login cookie. Retreiving one now.
Main.WebRequest - INFO - Fetching content at URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - INFO - Request for URL: http://www.furaffinity.net/controls/user-settings/ succeeded at Sun Sep  8 19:29:40 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 5.353K. Decompressed = 15.855K. File type: text/html; charset=UTF-8.
Main.CaptchaSolver - INFO - [2CaptchaUpload] Balance: 9.52588
Main.FaGet.StatusMgr - INFO - Captcha balance: 9.52588
Main.WebRequest - INFO - Fetching content at URL: https://www.furaffinity.net/login/
Main.WebRequest - INFO - Request for URL: https://www.furaffinity.net/login/ succeeded at Sun Sep  8 19:29:41 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 6.869K. Decompressed = 21.735K. File type: text/html; charset=UTF-8.
Main.WebRequest - INFO - Fetching content at URL: https://www.furaffinity.net/captcha.jpg
Main.WebRequest - INFO - Request for URL: https://www.furaffinity.net/captcha.jpg succeeded at Sun Sep  8 19:29:41 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = none. Content Size = 2.635K. File type: image/jpeg.
Main.FaGet.StatusMgr - INFO - Solving captcha. Please wait
files: {'file': ('captcha.jpg', <_io.BytesIO object at 0x000002609F9B08E8>)}
Main.CaptchaSolver - INFO - [2CaptchaUpload] Uploading to 2Captcha.com..
Main.CaptchaSolver - INFO - [2CaptchaUpload] Upload Ok
Main.CaptchaSolver - INFO - [2CaptchaUpload] Wait 30 second..
Main.CaptchaSolver - INFO - [2CaptchaUpload] Get Captcha solved with id 62237641817
Main.FaGet.StatusMgr - INFO - Captcha solving service result: 3a5kzv
Main.WebRequest - INFO - Fetching content at URL: https://www.furaffinity.net/login/?url=/
Main.WebRequest - INFO - Making a post-request! Params: '{'action': 'login', 'name': 'thisistheuser', 'pass': 'thisisthepassword', 'g-recaptcha-response': '', 'use_old_captcha': 1, 'captcha': '3a5kzv', 'login': 'Login to FurAffinity'}'
Main.WebRequest - INFO -        Item: 'action' -> 'login'
Main.WebRequest - INFO -        Item: 'name' -> 'thisistheuser'
Main.WebRequest - INFO -        Item: 'pass' -> 'thisisthepassword'
Main.WebRequest - INFO -        Item: 'g-recaptcha-response' -> ''
Main.WebRequest - INFO -        Item: 'use_old_captcha' -> '1'
Main.WebRequest - INFO -        Item: 'captcha' -> '3a5kzv'
Main.WebRequest - INFO -        Item: 'login' -> 'Login to FurAffinity'
Main.WebRequest - INFO - Request for URL: https://www.furaffinity.net/login/?url=/ succeeded at Sun Sep  8 19:30:14 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 6.912K. Decompressed = 21.964K. File type: text/html; charset=UTF-8.
Main.WebRequest - INFO - Fetching content at URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - INFO - Request for URL: http://www.furaffinity.net/controls/user-settings/ succeeded at Sun Sep  8 19:30:14 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 5.357K. Decompressed = 15.859K. File type: text/html; charset=UTF-8.
Main.FaGet.StatusMgr - INFO - Login attempt status = Login Failed.
Main.WebRequest - INFO - Fetching content at URL: http://www.furaffinity.net/controls/user-settings/
Main.WebRequest - INFO - Request for URL: http://www.furaffinity.net/controls/user-settings/ succeeded at Sun Sep  8 19:30:14 2019 On Attempt 1. Recieving...
Main.WebRequest - INFO - URL fully retrieved.
Main.WebRequest - INFO - Compression type = gzip. Content Size compressed = 5.357K. Decompressed = 15.859K. File type: text/html; charset=UTF-8.
Main.FaGet.StatusMgr - CRITICAL - Failed to download cookie! Exiting!

This was attempted with both webrequest==0.0.58 and webrequest==0.0.59

God-damnit-all commented 5 years ago

Also tried it before and after the latest commit.

Still a problem with webrequest==0.0.60 as well

herp-a-derp commented 5 years ago

Unfortunately, I'm not using 2Captcha at this point due to difficulties getting funding into it. I've basically switched to Anti-Captcha, because they accept paypal.

Can you use the web-view workaround to auth with fa?

God-damnit-all commented 5 years ago

If I emailed you my 2captcha API key, would you fix the 2captcha problem?

As for the manual login page (if that's what you're referring to), it just displays a broken image. image

God-damnit-all commented 5 years ago

Oh there's a probably useful error in the console when I navigate to that page.

404. Wat?
[2019-09-09 22:10:38,806] ERROR in app: Exception on /fa-manual-login [GET]
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python37\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python37\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python37\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Python37\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python37\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Python37\lib\site-packages\flask_httpauth.py", line 105, in decorated
    return f(*args, **kwargs)
  File "U:\xA-Scraper\xascraper\views\fa_manual_login.py", line 59, in fa_manual_login
    request_cookies[session['uuid']] = r.cookies['b']
  File "C:\Python37\lib\site-packages\requests\cookies.py", line 328, in __getitem__
    return self._find_no_duplicates(name)
  File "C:\Python37\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='b', domain=None, path=None"
Internal Error!
500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python37\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python37\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python37\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Python37\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python37\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Python37\lib\site-packages\flask_httpauth.py", line 105, in decorated
    return f(*args, **kwargs)
  File "U:\xA-Scraper\xascraper\views\fa_manual_login.py", line 59, in fa_manual_login
    request_cookies[session['uuid']] = r.cookies['b']
  File "C:\Python37\lib\site-packages\requests\cookies.py", line 328, in __getitem__
    return self._find_no_duplicates(name)
  File "C:\Python37\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='b', domain=None, path=None"
God-damnit-all commented 5 years ago

Okay the commit you just pushed to fix the 2captcha key path (which I'm not sure was even broken) just made things way worse:

Setting up loggers....
done
Setup
initialized manager
Creating pool
INFO: Creating engine for process! Engine name: 'MainProcess-MainThread'
Setting up loggers....
done
Setup
initialized manager
fetch args ['fa'] <class 'list'>
ScraperBase Init
Starting up
Starting up?
Main - CRITICAL - Uncaught exception!
Main - CRITICAL - Uncaught exception
Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "U:\xA-Scraper\manage\__main__.py", line 101, in <module>
    go()
  File "U:\xA-Scraper\manage\__main__.py", line 95, in go
    two_arg_go(sys.argv[1], sys.argv[2])
  File "U:\xA-Scraper\manage\__main__.py", line 48, in two_arg_go
    do_fetch([param])
  File "U:\xA-Scraper\manage\scrape_manage.py", line 75, in do_fetch
    do_plugin(plgname)
  File "U:\xA-Scraper\manage\scrape_manage.py", line 51, in do_plugin
    plg.runScraper(namespace)
  File "U:\xA-Scraper\xascraper\modules\scraper_base.py", line 678, in runScraper
    instance = cls()
  File "U:\xA-Scraper\xascraper\modules\scraper_base.py", line 115, in __init__
    super().__init__()
  File "U:\xA-Scraper\xascraper\modules\module_base.py", line 38, in __init__
    super().__init__()
  File "U:\xA-Scraper\xascraper\status_monitor.py", line 23, in __init__
    super().__init__()
  File "U:\xA-Scraper\util\captcha2upload.py", line 42, in __init__
    if (settings['captcha']['2captcha']['api_key'] and
KeyError: '2captcha'
herp-a-derp commented 5 years ago

The push I just made is because I'm moving the captcha solver keys around in order to support more then one solver service. You will need to fix your settings file (see the settings example for where stuff needs to go now).

herp-a-derp commented 5 years ago

Ok, I've moved all the captcha stuff into the upstream solver. It logs into FA fine for me.

Be aware, you will have to have webrequest >= 0.0.60 for this to work.

herp-a-derp commented 5 years ago

If login is still bouncing for you, take a look in the cookies.lwp file in the project root. You should have cookies that look like they'd fit these regexes, though the cookie string format will be a bit different (python repr vs lwp format).

herp-a-derp commented 5 years ago

The manual login failure is being caused by the fact that the call to fetch the captcha is getting stuck on cloudflare. It's not getting the expected cookie on page access that you then need to attach to the captcha request.

I didn't think about handling the access-cookie-not-set condition, so derp.

Really, just fuck captchas in general, tho.