camoufox icon indicating copy to clipboard operation
camoufox copied to clipboard

Human mouse movement typing

Open satanmp opened this issue 1 year ago • 9 comments

in Python, the mouse moves and inputs like a human, making the website unable to detect it,how can I do it, can you help me ,thanks?

satanmp avatar Sep 30 '24 10:09 satanmp

Hello,

This is something I plan on adding to the Python library soon. 👍

Edit: As mentioned in #7, theres a significant user base using Camoufox remotely, outside of the Camoufox library.

For that reason, I'll be working on implementing human-like mouse movement directly into Camoufox instead of the Python library.

daijro avatar Oct 02 '24 05:10 daijro

Hello,

This is something I plan on adding to the Python library soon. 👍

Edit: As mentioned in #7, theres a significant user base using Camoufox remotely, outside of the Camoufox library.

For that reason, I'll be working on implementing human-like mouse movement directly into Camoufox instead of the Python library.

Will it be optional?

desoforgit avatar Oct 02 '24 21:10 desoforgit

Will it be optional?

Yes, I will add a humanize:cursor property that can enable/disable it.

daijro avatar Oct 02 '24 21:10 daijro

Hello,

This is something I plan on adding to the Python library soon. 👍

Edit: As mentioned in #7, theres a significant user base using Camoufox remotely, outside of the Camoufox library.

For that reason, I'll be working on implementing human-like mouse movement directly into Camoufox instead of the Python library.

thanks

satanmp avatar Oct 03 '24 01:10 satanmp

Human-like mouse movement has been added in v130.0.1-beta.10.

Here is the demo from the README:

daijro avatar Oct 03 '24 02:10 daijro

Human-like mouse movement has been added in v130.0.1-beta.10.

Here is the demo from the README:

humanize-demo.mp4

👍

satanmp avatar Oct 03 '24 03:10 satanmp

The humanize parameter has just been added to the pypi library.

I will keep this issue open for support for human-like typing.

daijro avatar Oct 05 '24 00:10 daijro

Here is the demo from the README:

Hrhr, looks like it has the mode "drunk user" :-)

The humanize parameter has just been added to the pypi library.

Thanks!

tobwen avatar Oct 10 '24 23:10 tobwen

tested the humanize click function. It works like a charm. PS: it only works if you have click functionality in your playwright code.

tserebour avatar Oct 18 '24 02:10 tserebour

so the keyboard inputs are not yet humanized right? any way to achieve that? also how does mouse input work, does it send OS level input?

vlrevolution avatar Nov 04 '24 16:11 vlrevolution

so the keyboard inputs are not yet humanized right? any way to achieve that

I wrote this a while ago, maybe it can help @daijro. But be warned: the randomizer might need a fix. https://gist.github.com/tobwen/9c5d109e7bdfce163e4315a10c199f5d

tobwen avatar Nov 04 '24 16:11 tobwen

This is the solution I have in hrequests. It's a bit rough though, and doesn't account for the distribution of keys very well.

https://github.com/daijro/hrequests/blob/v0.9.0/hrequests/browser/browser.py#L277

    def type(self, selector: str, text: str, delay: int = 50, *, timeout: float = 30):
        for char in text:
            # Randomly enter characters with a 50% MOE
            self.page.keyboard.type(
                char, delay=randint(int(delay * 0.5), int(delay * 1.5))  # nosec
            )

daijro avatar Nov 04 '24 18:11 daijro

so the keyboard inputs are not yet humanized right? any way to achieve that

I wrote this a while ago, maybe it can help @daijro. But be warned: the randomizer might need a fix. https://gist.github.com/tobwen/9c5d109e7bdfce163e4315a10c199f5d

I absolutely love this solution. May I implement it and credit you?

daijro avatar Nov 04 '24 18:11 daijro

I absolutely love this solution. May I implement it and credit you?

Thanks, but you don't need to:

  1. I've released the code under CC0, so you're allowed to do anything with it,
  2. I live in a country where even preparing to spy on and intercept data could be considered a criminal offense. Tools and snipped might be part of this... The criminal investigation authorities often do not have the necessary understanding. It's a foggy situation. But you can of course use and integrate my code and get inspired from it!

Giving it to you I the best can do for your perfect work so far :D

As this is a command line tool, I was unable to implement many things: So you could move the cursor to enter words, select a whole word if necessary and of course remove it with the delete key. And of course enter double spaces, etc.

You can probably also calculate the keyboard distances for different locales. This could become a whole project

tobwen avatar Nov 04 '24 18:11 tobwen