Example #1
0
   except:
      print 'No pid_path provided, using /tmp/nx_extract.pid.'
      pid_path = "/tmp/nx_extract.pid"

   try:
      glob_pass = conf.get('nx_extract', 'password')
   except:
      print 'No password for web access ! Nx_extract will exit.'
      sys.exit(-1)
   fd.close()
   



   # log
   log = nxlogger(log_path, "nx_extract")
   log.warning("Starting nx_extract.")
   
   # handle case where we should not daemonize
   if single_run is True:
      ex = rules_extractor(pages_hit, rules_hit,  
                           glob_rules_file, glob_conf_file, log)
      ex.gen_basic_rules()
      base_rules, opti_rules = ex.opti_rules_back()
      opti_rules.sort(lambda a,b: (b['hratio']+(b['pratio']*3)) < (a['hratio']+(a['pratio']*3)))
      r = ex.format_rules_output(ex.final_rules)
      print r
      sys.exit(0)
      
   # handle case where we should not daemonize
   if stats_run is True:
Example #2
0
        for line in fd.readlines():
            monitor_tab.append(line.strip())
        fd.close()
        log.warning("Monitor enabled.")
    except:
        monitor_tab = None

    try:
        log_path = conf.get('nx_intercept', 'log_path')
    except:
        print "No log_path in conf file ! Using /tmp/nx_intercept.log"
        log_path = "/tmp/nx_intercept.log"

    fd.close()
    # log
    log = nxlogger(log_path, "nx_intercept")
    log.warning("Starting nx_intercept.")

    if len(logs_path) > 0:
        fill_db(logs_path, conf_path)
        sys.exit(0)

    try:
        reactor.listenTCP(port, InterceptFactory(), interface=iface)
        log.warning("Listening on port " + str(port) + " iface:" + iface)
    except:
        print "Unable to listen on " + str(port)
        log.critical("Unable to listen on " + str(port) + " iface:" + iface)
        sys.exit(-1)

    # & daemonize
Example #3
0
        for line in fd.readlines():
            monitor_tab.append(line.strip())
        fd.close()
        log.warning("Monitor enabled.")
    except:
        monitor_tab = None

    try:
        log_path = conf.get('nx_intercept', 'log_path')
    except:
        print "No log_path in conf file ! Using /tmp/nx_intercept.log"
        log_path = "/tmp/nx_intercept.log"
       
    fd.close()
    # log
    log = nxlogger(log_path, "nx_intercept")
    log.warning("Starting nx_intercept.")
    

    if len(logs_path) > 0:
        fill_db(logs_path, conf_path)
        sys.exit(0)

    try:
        reactor.listenTCP(port, InterceptFactory(), interface=iface)
        log.warning("Listening on port "+str(port)+" iface:"+iface)
    except:
        print "Unable to listen on "+str(port)
        log.critical("Unable to listen on "+str(port)+" iface:"+iface)
        sys.exit (-1)