def __init__(self, file, destinations): self.file = file self.destinations = destinations self.logger = Logger.Logger("%sPXCopy.log" % (PXPaths.LOG), "INFO", "DDB").getLogger() self.manager = PXManager.PXManager() self.manager.setLogger(self.logger) self.manager.initNames() self.drp = DirectRoutingParser.DirectRoutingParser(PXPaths.ROUTING_TABLE, [], self.logger) self.drp.printErrors = False self.drp.parseAlias() self.flowDirsCache = CacheManager.CacheManager(maxEntries=10000, timeout=2 * 3600) self.machine = socket.gethostname() cr = ConfReader("%spx.conf" % (PXPaths.ETC)) self.resendLimit = int(cr.getConfigValues("resendLimit")[0])
def __init__(self, file, destinations): self.file = file self.destinations = destinations self.logger = Logger.Logger("%sPXCopy.log" % (PXPaths.LOG), "INFO", "DDB").getLogger() self.manager = PXManager.PXManager() self.manager.setLogger(self.logger) self.manager.initNames() self.drp = DirectRoutingParser.DirectRoutingParser( PXPaths.ROUTING_TABLE, [], self.logger) self.drp.printErrors = False self.drp.parseAlias() self.flowDirsCache = CacheManager.CacheManager(maxEntries=10000, timeout=2 * 3600) self.machine = socket.gethostname() cr = ConfReader("%spx.conf" % (PXPaths.ETC)) self.resendLimit = int(cr.getConfigValues("resendLimit")[0])
def __init__(self): # We get the backends hostname with ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) self.machines = ",".join(cr.getConfigValues("backend")) self.headerRegexes = {} self.searchRegex = "" self.searchType = "" self.names = ['*'] self.logPath = "" self.since = 0 self.fromdate = "epoch" self.todate = "now" self.timesort = False self.ftp = False # These are the default wildcard regexes used throughout the whole program. self.alphanumericRegex = "[.[:alnum:]-]" self.digitRegex = "[[:digit:]]" self.zeroOrMoreRegex = "*" self.oneOrMoreRegex = "+" self.fillHeaderRegexes()
def __init__(self): # We get the backends hostname with ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) self.machines = ",".join(cr.getConfigValues("backend")) self.headerRegexes = {} self.searchRegex = "" self.searchType = "" self.names = ['*'] self.logPath = "" self.since = 0 self.fromdate = "epoch" self.todate = "now" self.timesort = False self.ftp = False # These are the default wildcard regexes used throughout the whole program. self.alphanumericRegex = "[.[:alnum:]-]" self.digitRegex = "[[:digit:]]" self.zeroOrMoreRegex = "*" self.oneOrMoreRegex = "+" self.fillHeaderRegexes()
import sys, os, commands sys.path.append(sys.path[0] + "/../../lib") sys.path.append("../../lib") sys.path.append("/apps/px/lib") from PDSPath import * from ColumboPaths import * from types import * from myTime import * import PXPaths PXPaths.normalPaths() import template from ConfReader import ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) targets = cr.getConfigValues("backend") user = cr.getConfigValues("user")[0] form = cgi.FieldStorage() machines = form["machines"].value def getLogNames(type): """ Gets the name of all logs on the target machines Arguments: type -> 'tx' or 'rx' Returns: a list of string """ logNames = [] for target in targets:
sys.path.append("/apps/px/lib") sys.path.append("/apps/px/lib/search") import template from PDSPath import * from ColumboPaths import * from types import * from myTime import * import searchResendUtils import PXPaths PXPaths.normalPaths() from ConfReader import ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) user = cr.getConfigValues("user")[0] form = cgi.FieldStorage() item = form["item"].value def readFromDB(file, host): """ Reads a bulletin file from the database. The output is copied to a temporary file on the local machine. Arguments: host -> machine that hosts the bulletin file dbPath -> path to the bulletin in the database Returns: path to the bulletin's copy """
import cgitb; cgitb.enable() import sys, os, commands sys.path.append(sys.path[0] + "/../../lib"); sys.path.append("../../lib") sys.path.append("/apps/px/lib") from PDSPath import * from ColumboPaths import * from types import * from myTime import * import PXPaths; PXPaths.normalPaths() import template from ConfReader import ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) targets = cr.getConfigValues("backend") user = cr.getConfigValues("user")[0] form = cgi.FieldStorage() machines = form["machines"].value def getLogNames(type): """ Gets the name of all logs on the target machines Arguments: type -> 'tx' or 'rx' Returns: a list of string """ logNames = [] for target in targets: status, output = commands.getstatusoutput('sudo -u %s ssh %s "ls -1 %s%s_*.log"' % (user, target, PXPaths.LOG, type))
import sys, os, pwd, time, re, pickle, commands sys.path.append(sys.path[0] + "/../../lib"); sys.path.append("../../lib") sys.path.append("/apps/px/lib") sys.path.append("/apps/px/lib/importedLibs") import template from PDSPath import * from ColumboPaths import * from types import * from myTime import * import PXPaths; PXPaths.normalPaths() from ConfReader import ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) user = cr.getConfigValues("user")[0] backends = cr.getConfigValues("backend") form = cgi.FieldStorage() def menuContent(): """ Creates the menu options dynamically Returns: a string """ flows = [] for backend in backends: status, output = commands.getstatusoutput("sudo -u %s ssh %s python /apps/px/lib/search/getFlowList.py" % (user, backend)) if not status: flows += output.split()
sys.path.append("../../lib") sys.path.append("/apps/px/lib") sys.path.append("/apps/px/lib/search") import template from PDSPath import * from ColumboPaths import * from types import * from myTime import * import searchResendUtils import PXPaths; PXPaths.normalPaths() from ConfReader import ConfReader cr = ConfReader("%spx.conf" % (PXPaths.ETC)) user = cr.getConfigValues("user")[0] form = cgi.FieldStorage() item = form["item"].value def readFromDB(file, host): """ Reads a bulletin file from the database. The output is copied to a temporary file on the local machine. Arguments: host -> machine that hosts the bulletin file dbPath -> path to the bulletin in the database Returns: path to the bulletin's copy """ dbPath = searchResendUtils.headerToLocation(file)