From a9ead485b067409b92a9c551bd5f5159ab3ae16b Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Fri, 1 Jul 2022 15:36:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D1=82=D0=B5=D1=80=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D1=82=D0=B8=D1=80=D1=83=D0=B5=D1=82=D1=81=D1=8F=20Window?= =?UTF-8?q?s=20Defender=20=D0=BA=D0=B0=D0=BA=20=D0=B2=D0=B8=D1=80=D1=83?= =?UTF-8?q?=D1=81=20PythonKeylogger=20-=20=D1=83=D0=B1=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B8=D0=B7=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/WorkLogger/PythonDebug_64.cmd | 2 - Utils/WorkLogger/WorkLogger.py | 63 ------ .../WorkLogger/pyWorkLogger/Catcher/Mouse.py | 203 ------------------ .../pyWorkLogger/Catcher/__init__.py | 0 Utils/WorkLogger/pyWorkLogger/__init__.py | 0 5 files changed, 268 deletions(-) delete mode 100644 Utils/WorkLogger/PythonDebug_64.cmd delete mode 100644 Utils/WorkLogger/WorkLogger.py delete mode 100644 Utils/WorkLogger/pyWorkLogger/Catcher/Mouse.py delete mode 100644 Utils/WorkLogger/pyWorkLogger/Catcher/__init__.py delete mode 100644 Utils/WorkLogger/pyWorkLogger/__init__.py diff --git a/Utils/WorkLogger/PythonDebug_64.cmd b/Utils/WorkLogger/PythonDebug_64.cmd deleted file mode 100644 index 20ca488a..00000000 --- a/Utils/WorkLogger/PythonDebug_64.cmd +++ /dev/null @@ -1,2 +0,0 @@ -..\..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe "pyWorkLogger\Catcher\Keyboard.py" -pause >nul \ No newline at end of file diff --git a/Utils/WorkLogger/WorkLogger.py b/Utils/WorkLogger/WorkLogger.py deleted file mode 100644 index bd354d84..00000000 --- a/Utils/WorkLogger/WorkLogger.py +++ /dev/null @@ -1,63 +0,0 @@ -from pynput import mouse - -def on_move(x, y): - print('Pointer moved to {0}'.format( - (x, y))) - -def on_click(x, y, button, pressed): - print('{0} at {1}'.format( - 'Pressed' if pressed else 'Released', - (x, y))) - print(button) - if not pressed: - # Stop listener - return True - -def on_scroll(x, y, dx, dy): - print('Scrolled {0} at {1}'.format( - 'down' if dy < 0 else 'up', - (x, y))) - -# Collect events until released -#with mouse.Listener( -# on_move=on_move, -# on_click=on_click, -# on_scroll=on_scroll) as listener: -# listener.join() - -# ...or, in a non-blocking fashion: -#listener = mouse.Listener( -# on_move=on_move, -# on_click=on_click, -# on_scroll=on_scroll) -#listener.start() - - -from pynput import keyboard - -def on_press(key): - try: - print('alphanumeric key {0} pressed'.format( - key.char)) - except AttributeError: - print('special key {0} pressed'.format( - key)) - -def on_release(key): - print('{0} released'.format( - key)) - if key == keyboard.Key.esc: - # Stop listener - return True - -# Collect events until released -with keyboard.Listener( - on_press=on_press, - on_release=on_release) as listener: - listener.join() - -# ...or, in a non-blocking fashion: -listener = keyboard.Listener( - on_press=on_press, - on_release=on_release) -listener.start() \ No newline at end of file diff --git a/Utils/WorkLogger/pyWorkLogger/Catcher/Mouse.py b/Utils/WorkLogger/pyWorkLogger/Catcher/Mouse.py deleted file mode 100644 index 7ff82f77..00000000 --- a/Utils/WorkLogger/pyWorkLogger/Catcher/Mouse.py +++ /dev/null @@ -1,203 +0,0 @@ -import datetime # datetime functions -import time # time functions -# Init the keyboard listener -def Init(inGSettings): - pass - -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# Technical defs -import pdb -SpecialKeyList = [] -inList = [ - # { - # "EventStartDatetime": datetime.datetime.now(), - # "EventEndDatetime": datetime.datetime.now(), - # "EventTypeStr": "MOVE", # MOVE | CLICK | SCROLL | SELECT - # "ValueInt": "" # MOVE: point count - # } -] -gMoveWaitNextPointSecondsMaxFloat = 5 -gMoveWaitNextPointPercentFloat = 4 -gMoveWaitNextPointSecondsFloat = None -gMovePrevious = None # {"EventDatetime": datetime.datetime.now(), "XInt": None, "YInt": None} -gMovePointCountInt = None -gMoveFirstDatetime = None -gMoveCloseCheckIntervalSecondsFloat = 3 - -from pynput import mouse -import mouse as mouse_new # https://github.com/boppreh/mouse#mouse.hook -def on_move(x, y): - global gMovePrevious - global gMoveWaitNextPointSecondsFloat - global gMoveWaitNextPointPercentFloat - global gMovePointCountInt - global gMoveFirstDatetime - lNowDatetime = datetime.datetime.now() - if gMovePrevious is None: - gMoveFirstDatetime = lNowDatetime - gMovePrevious = {"EventDatetime": gMoveFirstDatetime, "XInt": x, "YInt": y} - gMovePointCountInt = 1 - else: - lMovePreviousNew = {"EventDatetime": lNowDatetime, "XInt": x, "YInt": y} - lNewOldDeltaSecondsFloat = (lMovePreviousNew["EventDatetime"]-gMovePrevious["EventDatetime"]).total_seconds() - if gMoveWaitNextPointSecondsFloat is None: # We have no wait time - just calculate it - gMoveWaitNextPointSecondsFloat = lNewOldDeltaSecondsFloat * gMoveWaitNextPointPercentFloat # in the end for the next point - gMovePrevious = {"EventDatetime": lNowDatetime, "XInt": x, "YInt": y} - gMovePointCountInt = gMovePointCountInt + 1 - else: # check if we apply in time - else create new move record - if gMoveWaitNextPointSecondsFloat >= lNewOldDeltaSecondsFloat: # In applied second wait range - # Rewrite the globals - gMoveWaitNextPointSecondsFloat = lNewOldDeltaSecondsFloat * gMoveWaitNextPointPercentFloat # in the end for the next point - gMovePrevious = {"EventDatetime": lNowDatetime, "XInt": x, "YInt": y} - gMovePointCountInt = gMovePointCountInt + 1 - else: - if "left" not in SpecialKeyList: - pass - # Add in result list - #lResult = { - # "EventStartDatetime": gMoveFirstDatetime, - # "EventEndDatetime": lNowDatetime, - # "EventTypeStr": "MOVE", # MOVE | CLICK | SCROLL | SELECT - # "ValueInt": gMovePointCountInt # MOVE: point count - #} - #inList.append(lResult) - #print(lResult) - ## Close the move - #gMoveWaitNextPointSecondsFloat = None - #gMovePrevious = None - #gMovePointCountInt = None - #gMoveFirstDatetime= None - #print('Pointer moved to {0}'.format( - # (x, y))) - -def on_click(inButtonEvent): - global SpecialKeyList - global gMovePrevious - global gMoveWaitNextPointSecondsFloat - global gMoveWaitNextPointPercentFloat - global gMovePointCountInt - global gMoveFirstDatetime - lNowDatetime = datetime.datetime.now() - if inButtonEvent.button=="left" and inButtonEvent.event_type == "down": - SpecialKeyList.append("left") - # Close the previous move action - if gMovePrevious is not None: - # Add in result list - lResult = { - "EventStartDatetime": gMoveFirstDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "MOVE", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": gMovePointCountInt # MOVE: point count - } - inList.append(lResult) - print(lResult) - # Close the move - gMoveWaitNextPointSecondsFloat = None - gMovePrevious = None - gMovePointCountInt = None - gMoveFirstDatetime = None - elif inButtonEvent.button=="left" and inButtonEvent.event_type == "up": - if "left" in SpecialKeyList: SpecialKeyList.remove("left") - # Close the previous move action - if gMovePrevious is not None: - # Add in result list - lResult = { - "EventStartDatetime": gMoveFirstDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "SELECT", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": gMovePointCountInt # MOVE: point count - } - inList.append(lResult) - print(lResult) - # Close the move - gMoveWaitNextPointSecondsFloat = None - gMovePrevious = None - gMovePointCountInt = None - gMoveFirstDatetime = None - else: - # Add in result list - lResult = { - "EventStartDatetime": lNowDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "CLICK", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": 'left' # MOVE: point count - } - inList.append(lResult) - print(lResult) - # Close the move - gMoveWaitNextPointSecondsFloat = None - gMovePrevious = None - gMovePointCountInt = None - gMoveFirstDatetime = None - elif inButtonEvent.button=="right" and inButtonEvent.event_type == "up": - # Add in result list - lResult = { - "EventStartDatetime": lNowDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "CLICK", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": 'right' # MOVE: point count - } - inList.append(lResult) - print(lResult) - elif inButtonEvent.button=="middle" and inButtonEvent.event_type == "up": - # Add in result list - lResult = { - "EventStartDatetime": lNowDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "CLICK", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": 'middle' # MOVE: point count - } - inList.append(lResult) - print(lResult) - -def on_scroll(x, y, dx, dy): - print('Scrolled {0} at {1}'.format( - 'down' if dy < 0 else 'up', - (x, y))) - -# Collect events until released -#with mouse.Listener( -# on_move=on_move, -# on_click=on_click, -# on_scroll=on_scroll) as listener: -# listener.join() - -# ...or, in a non-blocking fashion: -#listener = mouse.Listener( -# on_move=on_move, -# on_click=on_click, -# on_scroll=on_scroll) -#listener.start() -def Test(inArg): - if type(inArg) is mouse_new._mouse_event.MoveEvent: - on_move(x = inArg.x, y = inArg.y) - elif type(inArg) is mouse_new._mouse_event.ButtonEvent: - on_click(inButtonEvent = inArg) - elif type(inArg) is mouse_new._mouse_event.WheelEvent: - print(inArg) -mouse_new.hook(Test) - -import pprint -while True: - # Check move interval - lNowDatetime = datetime.datetime.now() - if gMovePrevious is not None and gMoveWaitNextPointSecondsMaxFloat is not None and "left" not in SpecialKeyList: - lNewOldDeltaSecondsFloat = (lNowDatetime - gMovePrevious["EventDatetime"]).total_seconds() - if lNewOldDeltaSecondsFloat > gMoveWaitNextPointSecondsMaxFloat: - # Add in result list - lResult = { - "EventStartDatetime": gMoveFirstDatetime, - "EventEndDatetime": lNowDatetime, - "EventTypeStr": "MOVE", # MOVE | CLICK | SCROLL | SELECT - "ValueInt": gMovePointCountInt # MOVE: point count - } - inList.append(lResult) - print(lResult) - # Close the move - gMoveWaitNextPointSecondsFloat = None - gMovePrevious = None - gMovePointCountInt = None - gMoveFirstDatetime = None - time.sleep(gMoveCloseCheckIntervalSecondsFloat) - #print(inList) - #pprint.pprint(inList) \ No newline at end of file diff --git a/Utils/WorkLogger/pyWorkLogger/Catcher/__init__.py b/Utils/WorkLogger/pyWorkLogger/Catcher/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/Utils/WorkLogger/pyWorkLogger/__init__.py b/Utils/WorkLogger/pyWorkLogger/__init__.py deleted file mode 100644 index e69de29b..00000000