|
|
@ -10,6 +10,7 @@ import os
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
from sets import Set
|
|
|
|
from sets import Set
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
import datetime
|
|
|
|
|
|
|
|
|
|
|
|
class Analysis:
|
|
|
|
class Analysis:
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
@ -17,6 +18,9 @@ class Analysis:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
def post(self,object):
|
|
|
|
def post(self,object):
|
|
|
|
self.logs.append(object)
|
|
|
|
self.logs.append(object)
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
|
|
|
d = datetime.datetime.now()
|
|
|
|
|
|
|
|
self.now = {"month":d.month,"year":d.year, "day":d.day,"hour":d.hour}
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This class is designed to analyze environment variables. Environment variables can either be folders, files or simple values
|
|
|
|
This class is designed to analyze environment variables. Environment variables can either be folders, files or simple values
|
|
|
|
The class returns a quantifiable assessment of the environment variables (expected 100%)
|
|
|
|
The class returns a quantifiable assessment of the environment variables (expected 100%)
|
|
|
@ -25,6 +29,7 @@ class Env(Analysis):
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
Analysis.__init__(self)
|
|
|
|
Analysis.__init__(self)
|
|
|
|
def init(self,values):
|
|
|
|
def init(self,values):
|
|
|
|
|
|
|
|
Analysis.init(self)
|
|
|
|
self.values = values
|
|
|
|
self.values = values
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This function evaluate the validity of an environment variable by returning a 1 or 0 (computable)
|
|
|
|
This function evaluate the validity of an environment variable by returning a 1 or 0 (computable)
|
|
|
@ -61,6 +66,7 @@ class Sandbox(Analysis):
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
Analysis.__init__(self)
|
|
|
|
Analysis.__init__(self)
|
|
|
|
def init(self,conf):
|
|
|
|
def init(self,conf):
|
|
|
|
|
|
|
|
Analysis.init(self)
|
|
|
|
self.sandbox_path = conf['sandbox']
|
|
|
|
self.sandbox_path = conf['sandbox']
|
|
|
|
self.requirements_path = conf['requirements']
|
|
|
|
self.requirements_path = conf['requirements']
|
|
|
|
def get_requirements (self):
|
|
|
|
def get_requirements (self):
|
|
|
@ -98,6 +104,7 @@ class ProcessCounter(Analysis):
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
Analysis.__init__(self)
|
|
|
|
Analysis.__init__(self)
|
|
|
|
def init(self,names):
|
|
|
|
def init(self,names):
|
|
|
|
|
|
|
|
Analysis.init(self)
|
|
|
|
self.names = names
|
|
|
|
self.names = names
|
|
|
|
def evaluate(self,name):
|
|
|
|
def evaluate(self,name):
|
|
|
|
cmd = "".join(['ps -eo comm |grep ',name,' |wc -l'])
|
|
|
|
cmd = "".join(['ps -eo comm |grep ',name,' |wc -l'])
|
|
|
@ -120,6 +127,7 @@ class DetailProcess(Analysis):
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
Analysis.__init__(self)
|
|
|
|
Analysis.__init__(self)
|
|
|
|
def init (self,names):
|
|
|
|
def init (self,names):
|
|
|
|
|
|
|
|
Analysis.init(self)
|
|
|
|
self.names = names;
|
|
|
|
self.names = names;
|
|
|
|
def evaluate(self,name) :
|
|
|
|
def evaluate(self,name) :
|
|
|
|
cmd = "ps -eo pmem,pcpu,vsize,comm|grep :app$"
|
|
|
|
cmd = "ps -eo pmem,pcpu,vsize,comm|grep :app$"
|
|
|
|