I'm able to view the processes taking place on a remote computer on my network by using the wmi
module. This is an example using wmi to monitor the processes created and deleted on my own PC.
import wmi, multiprocessing
def create():
while True:
crePro = cp()
print('Creation',crePro.Caption,crePro.ProcessId,crePro.CreationDate)
def delete():
while True:
delPro = dp()
print('Deletion',delPro.Caption,delPro.ProcessId,delPro.CreationDate)
c = wmi.WMI()
cp = c.Win32_Process.watch_for("creation")
dp = c.Win32_Process.watch_for("deletion")
if __name__ == '__main__':
createProc = multiprocessing.Process(target = create)
deleteProc = multiprocessing.Process(target = delete)
createProc.start()
deleteProc.start()
I've also read about using win32gui
to get the active window.
import win32gui
win32gui.GetForegroundWindow()
And I've read about the existence of WM_SETFOCUS
and WM_ACTIVE
in win32con
, but I'm not certain how to connect to these streams on a remote PC.
My question is:
How do I monitor the active window of a remote PC (I suppose using either WM_SETFOCUS
or WM_ACTIVE
)