mikeyy / nonoCAPTCHA

An asynchronized Python library to automate solving ReCAPTCHA v2 using audio
GNU General Public License v3.0
896 stars 196 forks source link

AttributeError: 'Launcher' object has no attribute 'proc' #59

Open james-j-han opened 5 years ago

james-j-han commented 5 years ago

I've set headless to true as well.

MacKey-255 commented 5 years ago

I've set headless to true as well.

Men update of my forked or see my pull request. Salu2s

johnny-stevie commented 5 years ago

Is anything happening about this?

Datamined commented 5 years ago

Men update of my forked or see my pull request. Salu2s

I've tried your fork, but the error is still the same. OS: WIndows 7 64, python: 3.7.5

Full traceback:

C:\Python37\lib\site-packages\nonocaptcha\base.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. settings = yaml.load(f) Traceback (most recent call last): File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 65, in start self.browser = await self.get_new_browser() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 202, in get_new_browser browser = await self.launcher.launch() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 67, in launch env=env, File "C:\Python37\lib\asyncio\subprocess.py", line 217, in create_subprocess_exec stderr=stderr, kwds) File "C:\Python37\lib\asyncio\base_events.py", line 1533, in subprocess_exec bufsize, kwargs) File "C:\Python37\lib\asyncio\base_events.py", line 463, in _make_subprocess_transport raise NotImplementedError NotImplementedError Traceback (most recent call last): File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 80, in start raise e File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 65, in start self.browser = await self.get_new_browser() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 202, in get_new_browser browser = await self.launcher.launch() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 67, in launch env=env, File "C:\Python37\lib\asyncio\subprocess.py", line 217, in create_subprocess_exec stderr=stderr, kwds) File "C:\Python37\lib\asyncio\base_events.py", line 1533, in subprocess_exec bufsize, kwargs) File "C:\Python37\lib\asyncio\base_events.py", line 463, in _make_subprocess_transport raise NotImplementedError NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "demo.py", line 15, in solution = asyncio.get_event_loop().run_until_complete(client.start()) File "C:\Python37\lib\asyncio\base_events.py", line 584, in run_until_complete return future.result() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 93, in start await self.cleanup() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 148, in cleanup await self.launcher.killChrome() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 114, in killChrome await self.waitForChromeToClose() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 96, in waitForChromeToClose if self.proc.returncode is None and not self.chromeClosed: AttributeError: 'Launcher' object has no attribute 'proc'

MacKey-255 commented 5 years ago

Men update of my forked or see my pull request. Salu2s

I've tried your fork, but the error is still the same. OS: WIndows 7 64, python: 3.7.5

Full traceback:

C:\Python37\lib\site-packages\nonocaptcha\base.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. settings = yaml.load(f) Traceback (most recent call last): File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 65, in start self.browser = await self.get_new_browser() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 202, in get_new_browser browser = await self.launcher.launch() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 67, in launch env=env, File "C:\Python37\lib\asyncio\subprocess.py", line 217, in create_subprocess_exec stderr=stderr, kwds) File "C:\Python37\lib\asyncio\base_events.py", line 1533, in subprocess_exec bufsize, kwargs) File "C:\Python37\lib\asyncio\base_events.py", line 463, in _make_subprocess_transport raise NotImplementedError NotImplementedError Traceback (most recent call last): File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 80, in start raise e File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 65, in start self.browser = await self.get_new_browser() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 202, in get_new_browser browser = await self.launcher.launch() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 67, in launch env=env, File "C:\Python37\lib\asyncio\subprocess.py", line 217, in create_subprocess_exec stderr=stderr, kwds) File "C:\Python37\lib\asyncio\base_events.py", line 1533, in subprocess_exec bufsize, kwargs) File "C:\Python37\lib\asyncio\base_events.py", line 463, in _make_subprocess_transport raise NotImplementedError NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "demo.py", line 15, in solution = asyncio.get_event_loop().run_until_complete(client.start()) File "C:\Python37\lib\asyncio\base_events.py", line 584, in run_until_complete return future.result() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 93, in start await self.cleanup() File "C:\Python37\lib\site-packages\nonocaptcha\solver.py", line 148, in cleanup await self.launcher.killChrome() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 114, in killChrome await self.waitForChromeToClose() File "C:\Python37\lib\site-packages\nonocaptcha\launcher.py", line 96, in waitForChromeToClose if self.proc.returncode is None and not self.chromeClosed: AttributeError: 'Launcher' object has no attribute 'proc'

Look at this video: https://www.youtube.com/watch?v=zgwetyKmg5g Linux with Python 3.7.2 I need to test the project in Windows. Remember that the project needs to use the chrome browser. So it needs to be installed on your system. SAlu2s

Francesco149 commented 5 years ago

it really isn't that hard to fix if you take a quick look at the code. also on windows you need to use ProactorEventLoop otherwise subprocess will throw NotImplementedError

diff --git a/examples/basic.py b/examples/basic.py
index 1d4609a..354a46d 100644
--- a/examples/basic.py
+++ b/examples/basic.py
@@ -10,7 +10,7 @@ else:
     sys.exit(0)

-loop = asyncio.get_event_loop()
+loop = asyncio.ProactorEventLoop()
 options = {
     "headless": False,
     "ignoreHTTPSErrors": True,
diff --git a/nonocaptcha/launcher.py b/nonocaptcha/launcher.py
index 2c3030c..844f404 100644
--- a/nonocaptcha/launcher.py
+++ b/nonocaptcha/launcher.py
@@ -29,7 +29,7 @@ class Launcher(launcher.Launcher):
         self.port = get_free_port()
         self.url = f'http://127.0.0.1:{self.port}'
         self.chrome_args = [f'--remote-debugging-port={self.port}']
-        self._loop = self.options.get('loop', asyncio.get_event_loop())
+        self._loop = self.options.get('loop', asyncio.ProactorEventLoop())

         logLevel = self.options.get('logLevel')
         if logLevel:
@@ -94,6 +94,8 @@ class Launcher(launcher.Launcher):
         return data['webSocketDebuggerUrl']

     async def waitForChromeToClose(self):
+        if "proc" not in self.__dict__:
+            return
         if self.proc.returncode is None and not self.chromeClosed:
             self.chromeClosed = True
             try:
Francesco149 commented 5 years ago

full patch to make it work on windows: https://gist.github.com/314236b2ce5e7f5a96e846fe086e2dd6

Francesco149 commented 5 years ago

also, to evade the new detections you can adapt these bypass methods and it'll work: https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions

Francesco149 commented 5 years ago

working fork here, enjoy https://github.com/Francesco149/nonoCAPTCHA

MacKey-255 commented 5 years ago

Captcha image recognition working fork here https://github.com/MacKey-255/GoodByeCatpcha