librecaptcha icon indicating copy to clipboard operation
librecaptcha copied to clipboard

Error from harmony cli mode

Open camlafit opened this issue 4 years ago • 2 comments

Hello

I get an error on captcha tried when I use harmony on debian buster server. Only ssh mode.

Process followed to install it :

apt install python3-pip libcairo2-dev
pip3 install harmony-discord

Process use to get error with root user.

LIBRECAPTCHA_NO_GUI=1 /usr/local/bin/harmony
> log-in
Email address: [email protected]
Password: 

You must solve a CAPTCHA challenge.
You will be guided through the steps necessary to complete the challenge.
Press enter to start the challenge...

CHALLENGE OBJECTIVE: Select all squares with traffic lights

Error encountered while solving the CAPTCHA:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/harmony/harmony.py", line 301, in get_captcha_key
    debug=self.debug,
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/librecaptcha.py", line 78, in get_token
    return ui.run()
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 294, in run
    solution = self.run_solver(result)
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 302, in run_solver
    }[type(solver)](self, solver).run()
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 258, in run
    indices = self.handle_challenge(result)
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 271, in handle_challenge
    self.show_image(image)
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 158, in show_image
    proc = try_display_cmd(image)
  File "/usr/local/lib/python3.7/dist-packages/librecaptcha/cli.py", line 146, in try_display_cmd
    proc.stdin.write(img_bytes)
BrokenPipeError: [Errno 32] Broken pipe

Try another CAPTCHA? [y/N] 
CAPTCHA challenge failed.

camlafit avatar Jun 10 '21 13:06 camlafit

This is expected when there's no display server running (as is the case with an SSH session unless X forwarding is used)—librecaptcha needs to display images and can't do that over a plain text-based SSH session.

There should be a better error message than a “Broken pipe” traceback, though—I'll look into improving that when I have time.

taylordotfish avatar Jun 10 '21 21:06 taylordotfish

Hello

Thanks for your reply. As we have an option LIBRECAPTCHA_NO_GUI I have understood was possible to use on only cli mode.

camlafit avatar Jun 11 '21 06:06 camlafit