Bug when Hook Keyboard set to False

  • Grahack

    Grahack - 2009-04-02

    Running from sources version 1.0.4 on Ubuntu 8.10.
    Trace is here: http://pastealacon.com/2457
    By the way, why this config option?

    • nanotube

      nanotube - 2009-04-02


      well... i never really tested stuff with hookkeyboard=F for a loong time now. the option is there kind of "just for completeness", i never thought anyone would even try running with it. :)

      so, from a quick glance at the error and the code, the default value for contextEventMask in pyxhook.py is incorrect.

      I don't have time right now to dig into the docs to see what the contexteventmask tuple should be to make it log mouse but not keyboard. take a look at how contexteventmask is treated in pyxhook.py, and look at the docs for python-xlib, to see what it /should/ be doing if hookkeyboard=False.

      and of course, please post back here if what you find. :)

    • nanotube

      nanotube - 2009-04-02

      reproducing the error output here, just in case, because the pastebin will probably expire in the near future:

      RECORD extension version 1.13
      X protocol error:
      <class 'Xlib.error.BadValue'>: code = 2, resource_id = 0, sequence_number = 8, major_opcode = 143, minor_opcode = 1
      Exception in thread Thread-6:
      Traceback (most recent call last):
        File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
        File "/tmp/pykeylogger-1.0.4/pyxhook.py", line 113, in run
          self.record_dpy.record_enable_context(self.ctx, self.processevents)
        File "/var/lib/python-support/python2.5/Xlib/ext/record.py", line 240, in enable_context
          context = context)
        File "/var/lib/python-support/python2.5/Xlib/ext/record.py", line 217, in __init__
          apply(rq.ReplyRequest.__init__, (self, ) + args, keys)
        File "/var/lib/python-support/python2.5/Xlib/protocol/rq.py", line 1430, in __init__
        File "/var/lib/python-support/python2.5/Xlib/protocol/rq.py", line 1450, in reply
          raise self._error
      XError: <class 'Xlib.error.XError'>: code = 155, resource_id = 54525952, sequence_number = 9, major_opcode = 143, minor_opcode = 5

    • nanotube

      nanotube - 2009-05-15

      This bug now fixed in git, and it runs just fine now without hooking keyboard.

      Of course, if kb is not hooked, it cannot detect the control key combo, so running with hookkeyboard=F is still rather useless... :) but it runs, just as you'd expect it to.

  • mr.gender

    mr.gender - 2010-01-06

    Not having any keyboard hooked may be a good thing.
    There'd be no chance of the program revealing itself (and possibly being terminated) via the control panel by chance by anyone via the keyboard.

  • nanotube

    nanotube - 2010-01-07

    well, that is a plus - but note that if keyboard isn't hooked, it won't be logging any keyboard activity.

    so only if for some reason you have need to log only mouse activity or take periodic screenshots, then yes, it would be useful. :)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks