Operating system event monitoring package
This package implements event monitoring with processes, file system, and registry.
Installation
$ pip install pywinwatcher
Usage
Process event monitoring
from threading import Thread
import keyboard
import pythoncom
import pywinwatcher
class Monitor(Thread):
def __init__(self, action):
Thread.__init__(self)
self._action = action
def run(self):
print('Start monitoring...')
#Use pythoncom.CoInitialize when starting monitoring in a thread.
pythoncom.CoInitialize()
proc_mon = pywinwatcher.ProcessMonitor(self._action)
while not keyboard.is_pressed('ctrl+q'):
proc_mon.update()
print(
proc_mon.timestamp,
proc_mon.event_type,
proc_mon.name,
proc_mon.process_id
)
pythoncom.CoUninitialize()
monitor = Monitor('сreation')
monitor.start()
File system event monitoring
Example with FileMonitorAPI class use:
from threading import Thread
import keyboard
import pywinwatcher
class Monitor(Thread):
def __init__(self, action):
Thread.__init__(self)
self._action = action
def run(self):
print('Start monitoring...')
file_mon = pywinwatcher.FileMonitorAPI(Path=r'c:\\Windows')
while not keyboard.is_pressed('ctrl+q'):
file_mon.update()
print(
file_mon.timestamp,
file_mon.event_type
)
pythoncom.CoUninitialize()
monitor = Monitor()
monitor.start()
Example with FileMonitorWMI class use:
from threading import Thread
import keyboard
import pythoncom
import pywinwatcher
class Monitor(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
print('Start monitoring...')
#Use pythoncom.CoInitialize when starting monitoring in a thread.
pythoncom.CoInitialize()
file_mon = pywinwatcher.FileMonitorWMI(
Drive=r'e:',
Path=r'\\Windows\\',
FileName=r'text',
Extension=r'txt'
)
while not keyboard.is_pressed('ctrl+q'):
file_mon.update()
print(
file_mon.timestamp,
file_mon.event_type
)
pythoncom.CoUninitialize()
monitor = Monitor()
monitor.start()
Registry event monitoring
Example with RegistryMonitorAPI class use:
from threading import Thread
import keyboard
import pywinwatcher
class Monitor(Thread):
def __init__(self, action):
Thread.__init__(self)
self._action = action
def run(self):
print('Start monitoring...')
reg_mon = pywinwatcher.RegistryMonitorAPI(
'UnionChange',
Hive='HKEY_LOCAL_MACHINE',
KeyPath=r'SOFTWARE'
)
while not keyboard.is_pressed('ctrl+q'):
reg_mon.update()
print(
reg_mon.timestamp,
reg_mon.event_type
)
pythoncom.CoUninitialize()
monitor = Monitor()
monitor.start()
Example with RegistryMonitorWMI class use:
from threading import Thread
import keyboard
import pythoncom
import pywinwatcher
class Monitor(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
print('Start monitoring...')
#Use pythoncom.CoInitialize when starting monitoring in a thread.
pythoncom.CoInitialize()
reg_mon = pywinwatcher.RegistryMonitorWMI(
'KeyChange',
Hive='HKEY_LOCAL_MACHINE',
KeyPath=r'SOFTWARE'
)
while not keyboard.is_pressed('ctrl+q'):
reg_mon.update()
print(
reg_mon.timestamp,
reg_mon.event_type
)
pythoncom.CoUninitialize()
monitor = Monitor()
monitor.start()
License
MIT Copyright (c) 2021 Evgeny Drobotun
Release History
0.0.1 (05.05.2021)
First release of pywinwatcher
Metadata
Release files for pywinwatcher 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pywinwatcher-0.0.1.tar.gz | 9.7 kB | Without provenance | Details for pywinwatcher-0.0.1.tar.gz |
Release files / pywinwatcher-0.0.1.tar.gz
| Download URL | pywinwatcher-0.0.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ff7e3c0152758a0cba5cc000345c87aa50fbf8068e84e76fc2cc0f803eb31e4
|
|
BLAKE2b-256 checksum How to use checksums |
7ee2296228924f59977140731fdd77650a8792ae5a6a63a4bf1ef90eb8765b47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.8
|
Security for pywinwatcher 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.