Skip to content

Instantly share code, notes, and snippets.

@rjoleary
Created February 10, 2014 16:59
Show Gist options
  • Save rjoleary/8919859 to your computer and use it in GitHub Desktop.
Save rjoleary/8919859 to your computer and use it in GitHub Desktop.
This Python script lists the processes created in a 5 s time interval.
import os
import re
import time
# Return a set of running processes.
def process_set():
# Assume Windows.
return set(re.findall('Image Name: (.*)',
os.popen('tasklist /fo list').read()))
# Return the processes created in the time interval t.
def processes_created(t):
t1 = process_set()
time.sleep(t)
t2 = process_set()
return t2 - t1
# Return the processes created on a 5 s interval.
if __name__ == "__main__":
print(processes_created(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment