コード例 #1
0
ファイル: PXCopy.py プロジェクト: khosrow/metpx
    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])
コード例 #2
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])
コード例 #3
0
ファイル: SearchObject.py プロジェクト: nourou6/Sundew
    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()
コード例 #4
0
ファイル: SearchObject.py プロジェクト: hawkeye438/metpx
 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()
コード例 #5
0
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:
コード例 #6
0
ファイル: pxBulletinDetails.py プロジェクト: khosrow/metpx
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
    """
コード例 #7
0
ファイル: pxSearchQuery.py プロジェクト: hawkeye438/metpx
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))
コード例 #8
0
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()
コード例 #9
0
ファイル: pxBulletinDetails.py プロジェクト: hawkeye438/metpx
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)