Created
February 10, 2014 16:59
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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