Comment by ephou7

Comment by ephou7 4 days ago

5 replies

I used this:

#!/usr/bin/python3 import subprocess import time import random with open("/tmp/x") as f: t = f.read() for c in t: subprocess.call([ "xdotool", "type", c ]) time.sleep(abs(random.gauss(0,0.07)))

And pasted a random Hacker News comment:

Authenticity Score 81 Highly Authentic

Words per minute: 162 Keystroke variance: 52ms Paste attempts: 0 Window/tab switches: 4 Pauses (≥10s): 0 DOM manipulations: 0

You failed.

abetusk 3 days ago

`xdotool` is awesome and this is the first I'm hearing of it. Thanks.

Do you have any other command line tool recommendations?

callmeed 3 days ago

That's cool, thanks for sharing.

Is there a way to detect this approach?

  • abetusk 3 days ago

    I think your approach is pretty much fundamentally flawed.

    Put it this way, let's say someone recorded typing in the paragraph that you presented but saved the keystrokes, pauses, etc. Now they replay it back, with all the pauses and keystrokes, maybe with the `xdotool` as above, how could you possibly know the difference?

    Your method is playing a statistical game of key presses, pauses, etc. Anyone who understands your method will probably not only be able to create a distribution that matches what you expect but could, in theory, create something that looks completely inhuman but will sneak past your statistical tests.

  • cyode 3 days ago

    Most text composition involves backspaces and cursor movement. This script simulated neither afaik, though I’m sure it could have without much more difficultly.

    Probably you will need to track many signals like those and use a model that takes them all into account.

  • majorchord 2 days ago

    Every OS has a similar facility for emulating keystrokes, and then there's the hardware solutions, e.g. raspberry pi that masquerades as a keyboard. It's practically impossible to prevent someone from cheating if they are motivated enough.