コード例 #1
0
    def __init__(self):

        if os.path.isfile('./file.csv'): self.CSV_Setter()

        hk = Hook()
        hk.handler = self.Handle_Events
        thread = threading.Thread(target=hk.hook)
        thread.setDaemon(True)
        thread.start()

        while True:
            pygame.display.update()
            screen.fill((100, 100, 100))

            call_count = 0

            for key, value in ID_TO_COUNT.items():
                keyAndValue = str(key) + ' : ' + str(value)
                call_count = call_count + 1
                self.Txt_Label(keyAndValue, call_count)

            for event in pygame.event.get():
                if event.type == QUIT:
                    self.CSV_Writer()
                    sys.exit()
コード例 #2
0
 def mainloop(self):
     """ Endless loop in this function and get keyboard event.
     """
     # create a hook manager
     self.hk = Hook()
     # watch for all mouse events
     self.hk.handler = self.handle_events
     #hm.handler = self.OnKeyboardEvent
     # set the hook
     self.hk.hook()
コード例 #3
0
ファイル: example_gui.py プロジェクト: qzane/pyhooked
    def __init__(self, *args):
        QMainWindow.__init__(self, *args)

        self.label = QLabel(self)
        self.label.setText('A PySide Window')
        self.resize(640, 480)
        hk = Hook()  # make a new instance of PyHooked
        hk.handler = self.foo  # set the handler function
        # thread the call to hook, otherwise we block the GUI
        thread = threading.Thread(target=hk.hook)
        # start hooking
        thread.start()
コード例 #4
0
 def run(self):
     self.allowedEvent = ('KEY_UP', 'KEY_LEFT', 'KEY_RIGHT', 'KEY_DOWN')
     if platform.system()=='Linux':
         self.code2key = dict()
         self.val2sts = {1: 'press', 2: 'keep-press', 0: 'release'}
         self.code2key = json.load(open(keyboard_name, 'r'))
         if detectInputKeyInLinux:
             self.detectInputKey()
     elif platform.system()=='Windows':
         from pyhooked import Hook, KeyboardEvent
         self.KeyboardEvent=KeyboardEvent
         self.hk = Hook()  # make a new instance of PyHooked
         self.hk.handler = self.handle_events  # add a new shortcut ctrl+a, or triggered on mouseover of (300,400)
         self.hk.hook()  # hook into the events, and listen to the presses
コード例 #5
0
ファイル: main.py プロジェクト: Sambuilder/myTopSup
        if isinstance(args, KeyboardEvent):
            if args.current_key == self.hot_key and args.event_type == 'key down':
                self.main()
            elif args.current_key == 'Q' and args.event_type == 'key down':
                hk.stop()
                print('退出啦~')


if __name__ == "__main__":
    try:
        helper = TopSupHelper()
        print("配置文件正常加载!\n")
    except:
        print("配置文件异常,尝试使用默认配置\n")
    try:
        browser = webdriver.Chrome(r'.\tools\chromedriver.exe')
        browser.get(helper.search_engine)
    except:
        print("chrome浏览器打开异常,可能是版本不对\n")
    hld = win32gui.FindWindow(None, helper.vm_name)
    if hld > 0:
        print(
            '使用前记得去config.ini把配置改好哦~~,主要是自己申请换key,不然次数很快就用完啦~~\n\n用模拟器打开对应应用~~\n题目出现的时候按F2,我就自动帮你去搜啦~\n'
        )
        hk = Hook()
        hk.handler = helper.handle_events
        hk.hook()
    else:
        print('咦,你没打开' + helper.vm_name + '吧!请打开' + helper.vm_name +
              '并重启下start.exe')
コード例 #6
0
ファイル: test.py プロジェクト: kansyokuk/NetworkProgramming
from pyhooked import Hook, KeyboardEvent, MouseEvent
import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

def handle_events(args):
    if isinstance(args, KeyboardEvent):
        print(args.key_code, args.current_key, args.event_type)

hk = Hook()  # make a new instance of PyHooked
hk.handler = handle_events  # add a new shortcut ctrl+a, or triggered on mouseover of (300,400)
hk.hook()  # hook into the events, and listen to the press
コード例 #7
0
 def __init__(self):
     super().__init__()
     self.input = QLineEdit(self)
     self.hk = Hook()
     self.init_ui()
コード例 #8
0
    h_process = kernel32.OpenProcess(0x400 | 0x10, False, pid)
    psapi.GetModuleBaseNameA(h_process, None, byref(executable), 512)
    window_title = create_string_buffer(512)
    length = user32.GetWindowTextA(hwnd, byref(window_title), 512)
    kernel32.CloseHandle(hwnd)
    kernel32.CloseHandle(h_process)
    return window_title.value.decode('cp932', 'ignore')


def event(args):
    global window_current
    if isinstance(args, KeyboardEvent):
        if 'down' in args.event_type:
            now_window = get_current_process()
            if window_current != now_window:
                input_key.append(now_window + "\n")
                window_current = now_window
            if args.current_key not in ['Left', 'Up', 'Right', 'Down']:
                input_key.append(args.current_key)
            if 'Return' == args.current_key:
                with open(save_file, 'a') as f:
                    f.write(''.join(input_key) + '\n')
                input_key.clear()


setting_keylogger()
window_current = get_current_process()
hook = Hook()
hook.handler = event
hook.hook()
コード例 #9
0
 def hook_thread(self):
     hk = Hook()  # make a new instance of PyHooked
     hk.handler = self.handle_events  # add a new shortcut ctrl+a, or triggered on mouseover of (300,400)
     hk.hook()  # hook into the events, and listen to the presses
コード例 #10
0
from pyhooked import Hook, KeyboardEvent

h = Hook()


def f(event):
    if isinstance(event, KeyboardEvent):
        print(event.pressed_key)
        if event.pressed_key == ['Q']:
            h.stop()
        else:
            raise Exception()


h.handler = f

if __name__ == '__main__':
    h.hook(mouse=True)
コード例 #11
0
ファイル: hot_key.py プロジェクト: shad0w008/gjqt-script
 def __init__(self):
     self.hk = Hook()
     self.handler: Dict[str, EvenLoop] = {}
     self.thread = None
コード例 #12
0
def keyboard_check():
    hk = Hook()
    hk.handler = handle_events
    thread = threading.Thread(target=hk.hook)
    thread.setDaemon(True)
    thread.start()
コード例 #13
0
ファイル: windowsReg.py プロジェクト: heyuanree/fxxku
 def __init__(self):
     self.hk = Hook()
     self.fk = Fxxku()
コード例 #14
0
ファイル: PyHook.py プロジェクト: mlna717/cardhit
def notifyListen(chatWdw):
    global chatFrame
    chatFrame = chatWdw
    hk = Hook()
    hk.handler = handle_events
    hk.hook()
コード例 #15
0
 def listen():
     hk = Hook()  # make a new instance of PyHooked
     hk.handler = handle_events  # add callback for occuring events
     logging.debug("Starting hotkey listener daemon..")
     thread = threading.Thread(target=hk.hook, daemon=True)
     thread.start()  # start listening on new thread
コード例 #16
0
ファイル: KeyLogger.py プロジェクト: shintoutou/trojan
def run(**kwargs):
    hk = Hook()  # make a new instance of PyHooked
    hk.handler = keyStroke  # add a new shortcut ctrl+a, or triggered on mouseover of (300,400)
    hk.hook()  # hook into the events, and listen to the presses