|
|
@ -86,20 +86,24 @@ class Sandbox(Analysis):
|
|
|
|
This class performs the analysis of a list of processes and determines
|
|
|
|
This class performs the analysis of a list of processes and determines
|
|
|
|
The class provides a quantifiable measure of how many processes it found over all
|
|
|
|
The class provides a quantifiable measure of how many processes it found over all
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
class Processes(Analysis):
|
|
|
|
class ProcessCounter(Analysis):
|
|
|
|
def __init__(self,names):
|
|
|
|
def __init__(self,names):
|
|
|
|
Analysis.__init__(self)
|
|
|
|
Analysis.__init__(self)
|
|
|
|
self.names = names
|
|
|
|
self.names = names
|
|
|
|
def evaluate(self,name):
|
|
|
|
def evaluate(self,name):
|
|
|
|
cmd = "".join(['ps aux |grep -E "^ {0,}',name,'" |wc -l'])
|
|
|
|
cmd = "".join(['ps -eo comm |grep ',name,' |wc -l'])
|
|
|
|
handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
|
|
|
|
handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
|
|
|
|
|
|
|
|
|
|
|
|
return int(handler.communicate()[0].replace('\n','')) > 0
|
|
|
|
return int(handler.communicate()[0].replace("\n","") )
|
|
|
|
def composite(self):
|
|
|
|
def composite(self):
|
|
|
|
r = [ self.evaluate(name) for name in self.names]
|
|
|
|
r = {}
|
|
|
|
N = len(r)
|
|
|
|
for name in self.names :
|
|
|
|
n = sum(r)
|
|
|
|
r[name] = self.evaluate(name)
|
|
|
|
return n/N
|
|
|
|
|
|
|
|
|
|
|
|
#N = len(r)
|
|
|
|
|
|
|
|
#n = sum(r)
|
|
|
|
|
|
|
|
#return n/N
|
|
|
|
|
|
|
|
return r
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This class returns an application's both memory and cpu usage
|
|
|
|
This class returns an application's both memory and cpu usage
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|