Coder Social home page Coder Social logo

pyxhook's Introduction

pyxhook's People

Contributors

cjwelborn avatar eitchtee avatar franzpl avatar haim0n avatar jeffhoogland avatar loonydev avatar mkrnr avatar plowsec avatar vishaltak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyxhook's Issues

Add to PyPi package manager

#Hello,
i like your package, but i think that a better way to use it is to add it on PyPi.
Can you do that?
If you like to do this but you will have some troubles, I would be happy to help you. I own a couple of modules on PyPi.

Thanks

ImportError: No module named Image

Trying to run the example yields:

File "pyxhook\pyxhook.py", line 41, in <module>
    import Image
ImportError: No module named Image

This looks like a leftover from pykeylogger, Image is not even used in the pyxhook module.

Microsoft has blocked this

Not sure if you have anything to do with this script or are just providing a mirror, but it's actually been blocked by Microsoft, and Windows Defender will automatically remove it. Not sure if there'd be much you can do about that.

https://www.virustotal.com/gui/file-analysis/ODYwMGFhYjc5ZTZjYjQwOTQzYTZhZTU3YWVhZjk0ZDc6MTYyNTY0Njk5OA==/detection

image

I know it's a Linux script, but in my case I have multiple OS support in my code. I'm switching from including the file to adding it to requirements.txt so it's not a problem for me, just letting you know.

adding __init__.py

I would suggest to add init.py file so it can be used as python module/lib.

Swallow user input when HookManager is active

Hello,

thanks for this nice module.

I want to write a script that swallows/catches the user input so that it is not sent to the current window, while the HookManager is active.
Can this be done with the current pyxhook version? (I don't understand much of the source code.)
If not, then this is a feature request for implementing it ;-)

ps: Sorry if this question does not belong here, but I dont know where else to ask.

Linux still prints screen when hitting "print"

Hi, I'm trying to use pyxhook to catch users hitting the "print screen" key. I successfully catch the event, but linux still run the default behavior, which is making a screenshot. With pyhook on Windows, the behavior is different, as the default "print screen" action is not happening.

One solution could be to remove the mapping between "print screen" and screenshot under linux, but I'd like to avoid that, making life easier to support different distros and OS.

Is there a way to "consume" the event after it was caught by my script ?

Conflicting notices of Copyright.

Your license.txt conflicts with the pyxhook.py's built in notice of license, and you've claimed copyright with all rights reserved over someone else's unmodified GPLv2 software. The GPL prohibits sublicensing.

centos

/usr/bin/python2.7 /home/jin/PycharmProjects/python_android_utils/cf/liunx_monitor/example.py
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
self.run()
File "/home/jin/PycharmProjects/python_android_utils/cf/liunx_monitor/pyxhook.py", line 132, in run
'client_died': True
File "/usr/lib/python2.7/site-packages/Xlib/ext/record.py", line 121, in create_context
ranges = ranges)
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 1418, in init
self._binary = apply(self._request.to_binary, args, keys)
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 1103, in to_binary
return apply(self.to_binary, varargs, keys)
File "", line 3, in to_binary
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 525, in pack_value
data.append(self.type.pack_value(v))
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 1117, in pack_value
return apply(self.to_binary, (), value)
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 1103, in to_binary
return apply(self.to_binary, varargs, keys)
File "", line 4, in to_binary
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 575, in check_value
v = f.check_value(val[i])
File "/usr/lib/python2.7/site-packages/Xlib/protocol/rq.py", line 588, in check_value
raise TypeError('Object value must be tuple, dictionary or DictWrapper: %s' % val)
TypeError: Object value must be tuple, dictionary or DictWrapper: 0

Could you provide an example with all the key presses suppressed?

When I use pynput package, with Suppress=True, it is found that only key input inside the terminal is suppressed. But I want all key presses (in any app which has the focus) are suppressed for a while (untill some conditions meet). For background information please see here

I find no direct examples on XGrabKeyboard and XUnGrabKeyboard.
But I guess pyxhook is based on xlib, and you may be able to help me to code an example. :-)

Release to pypi

Is there any release plan ? if not maybe I can take care of that :)

Ascii codes are not correct

Many ascii codes are incorrect. 'X', 'K' and '_' do have code 0 according to the code. Many other keys like arrow keys get an ascii code from 81 to 84, while those are reserved for QRST.

"Xlib.error.DisplayNameError: Bad display name" - do I need XQuartz?

Thanks for the software. I hope it will work on mac OS X as well.
I had to install Xlib and I done this on my virtualenv with

pip install svn+https://svn.code.sf.net/p/python-xlib/code/trunk/

Now I get with pip freeze

python-xlib==0.15rc1

When running the script I get the error:

(env)@mymac:/mytest/keylog$ python keylog.py 
Traceback (most recent call last):
  File "keylog.py", line 21, in <module>
    hookman = pyxhook.HookManager()
  File "/mytest/keylog/pyxhook.py", line 83, in __init__
    self.local_dpy = display.Display()
  File "/mytest/keylog/env/lib/python2.7/site-packages/Xlib/display.py", line 83, in __init__
    self.display = _BaseDisplay(display)
  File "/mytest/keylog/env/lib/python2.7/site-packages/Xlib/display.py", line 65, in __init__
    apply(protocol.display.Display.__init__, (self, ) + args, keys)
  File "/mytest/keylog/env/lib/python2.7/site-packages/Xlib/protocol/display.py", line 45, in __init__
    name, host, displayno, screenno = connect.get_display(display)
  File "/mytest/keylog/env/lib/python2.7/site-packages/Xlib/support/connect.py", line 65, in get_display
    return mod.get_display(display)
  File "/mytest/keylog/env/lib/python2.7/site-packages/Xlib/support/unix_connect.py", line 59, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""
(env)@mymac:/mytest/keylog$ 

It looks like the problem is that DISPLAY environment variable is empty:

(env)@mymac:/mytest/keylog$ echo $DISPLAY

(env)@mymac:/mytest/keylog$ 

Does this mean I need to install XQuartz?
Or there is a problem with Xlib?

120% CPU usage after a few minutes

`def pr(e):
print(e)

import pyxhook as H
manager=H.HookManager()
manager.KeyDown = pr

manager.HookKeyboard()

manager.start()`

When using the above code and using the latest pyxhook (Python 2.7), the process starts to consume 100% CPU after several minutes (current sample: 20seconds, 1minute30seconds,4minutes,20minutes). Printing events also stops.
The same thing happens when I run pyxhook. There seems to be a part of the code that fails silently (perhaps it is silent because of threading?).

manager.cancel() does not cancel the thread, corroborating the idea that something has failed somewhere. Could you have a look at this? Ctrl+C also does not exit the code. Ctrl+Z makes the process zombie.

I saw that your implementation shares parts of code with the recorder_demo.py from Xlib. When I run the recorder_demo.py, I do not get the large CPU usage.

It seems to consistently fail when I press [Return] with an active firefox window. Maybe this helps?

Parameters doesn't seem to work

Using this example: https://github.com/JeffHoogland/pyxhook/blob/master/example_with_parameters.py

It produces the error:
Traceback (most recent call last):
File "pykeylogger3.py", line 22, in
hookman = pyxhook.HookManager(parameters=True)
TypeError: init() got an unexpected keyword argument 'parameters'

I'm really not great at OOP, but looking at https://github.com/JeffHoogland/pyxhook/blob/master/pyxhook.py ling 65 for the init of the HookManager class has

def init(self,parameters=False):

Which hookman = pyxhook.HookManager(parameters=True) should override (sorry if that is not the correct term) with the line hookman.KeyDownParameters = parameters (provided parameters is a properly formatted dict).

Starting on line 94 of pyxhook.py is looks like the code is there to process the parameters but this is where I start getting lost. Sorry. Wish I could help by point out what's wrong.

pykeylogger3

Bad Display Name

I can't get this running. ive used pip to install the pyxhook module and tried using both python 2.7 and 3.6.5.

Traceback (most recent call last):
File "keylog.py", line 25, in
hookman = pyxhook.HookManager()
File "/usr/local/lib/python3.6/site-packages/pyxhook/pyxhook.py", line 67, in init
self.local_dpy = display.Display()
File "/usr/local/lib/python3.6/site-packages/Xlib/display.py", line 89, in init
self.display = _BaseDisplay(display)
File "/usr/local/lib/python3.6/site-packages/Xlib/display.py", line 71, in init
protocol_display.Display.init(self, *args, **keys)
File "/usr/local/lib/python3.6/site-packages/Xlib/protocol/display.py", line 85, in init
name, protocol, host, displayno, screenno = connect.get_display(display)
File "/usr/local/lib/python3.6/site-packages/Xlib/support/connect.py", line 73, in get_display
return mod.get_display(display)
File "/usr/local/lib/python3.6/site-packages/Xlib/support/unix_connect.py", line 61, in get_display
raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""

Can someone help me with this please

Checking if key is in list

Hello
I would like to make a simple grab keys python3 script, that gets the keys and then checks the list if there is a key or not and then returns an array. I tried this:
#Takes string returns array! def keys_to_array(key): if key == "w": return [0, 1, 0] elif key == "a": return [1, 0, 0] elif key == "d": return [0, 0, 1] else: return "Not working as supposed or None!"

Please help it is not working as supposed and returning Not working as supposed or None!. I suppose there is a problem that the key that is returning is not a string but NoneType. But i dont know

Petr Gardas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.