コード例 #1
0
ファイル: altlog.py プロジェクト: cyberintelframework/sensor
def inthandler(signum, frame):
    """ Signal handler for ctrl-c """
    import os
    from sensor import functions as f
    from sensor import dialog
    di = dialog.Dialog()
    logging.debug("SIGINT received")

    if f.managerStatus(str(os.getpid())):
        di.setBackgroundTitle('SURFids v3.0 sensor running on ' + f.system())
        di.infobox("CTRL-C received, shutting down sensor...")
        # Shutting down the sensor
        try:
            f.sensorDown()
        except:
            logging.error("Could not shutdown the sensor during SIGINT")

        logging.debug("WATCHME inthandler cleanup phase")
        # Cleaning up temporary files
        f.cleanUp()

#    if os.path.exists(locations.OPENVPNPID):
#        os.unlink(locations.OPENVPNPID)
    os.system('clear')
    logging.warning("SURFids menu stopped (received ctrl-c)")
    sys.exit(1)
コード例 #2
0
ファイル: log.py プロジェクト: cyberintelframework/sensor
def inthandler(signum, frame):
    """ Signal handler for ctrl-c """
    import os
    from sensor import functions as f
    from sensor import dialog

    di = dialog.Dialog()
    logging.debug("SIGINT received")
    logging.debug("WATCHMEEE INTHANDLER SIGINT received")

    if f.managerStatus(str(os.getpid())):
        di.setBackgroundTitle("SURFids v3.0 sensor running on " + f.system())
        di.infobox("CTRL-C received, shutting down sensor...")
        # Shutting down the sensor
        try:
            logging.debug("WATCHMEEE INTHANDLER f.sensorDown")
            logging.debug("WATCHMEEE INTHANDLER tunnel status: %s" % str(f.tunnelStatus()))
            f.sensorDown()
            logging.debug("WATCHMEEE INTHANDLER tunnel status: %s" % str(f.tunnelStatus()))
        except:
            err = str(sys.exc_info()[1])
            logging.debug("WATCHMEEE error: %s" % str(err))
            logging.error("Could not shutdown the sensor during SIGINT")

        logging.debug("WATCHMEEE inthandler cleanup phase")
        # Cleaning up temporary files
        f.cleanUp()
        logging.debug("WATCHMEEE INTHANDLER tunnel status: %s" % str(f.tunnelStatus()))

    #    if os.path.exists(locations.OPENVPNPID):
    #        os.unlink(locations.OPENVPNPID)
    os.system("clear")
    logging.warning("SURFids menu stopped (received ctrl-c)")
    sys.exit(1)
コード例 #3
0
ファイル: manager.py プロジェクト: cyberintelframework/sensor
    def __init__(self):
        logging.debugv("manager.py->__init__(self)", [])

        os.putenv('LANG', 'en_US.UTF-8')
        os.environ['LANG'] = 'en_US.UTF-8'

        self.c = config.Config()
        self.d = dialog.Dialog()

        if not f.managerStatus():
            logging.debug("No manager running, cleaning up, writing PID")
            f.cleanUp()
            f.writePID()

        f.suppressDmesg()

        if not f.checkRoot():
            logging.error("Not root, you should run the manager as root")
            sys.exit(1)
コード例 #4
0
ファイル: manager.py プロジェクト: cyberintelframework/sensor
    def __init__(self):
    	logging.debugv("manager.py->__init__(self)", [])

        os.putenv('LANG', 'en_US.UTF-8')
        os.environ['LANG'] = 'en_US.UTF-8'

        self.c = config.Config()
        self.d = dialog.Dialog()

        if not f.managerStatus():
            logging.debug("No manager running, cleaning up, writing PID")
            f.cleanUp()
            f.writePID()

        f.suppressDmesg()

        if not f.checkRoot():
            logging.error("Not root, you should run the manager as root")
            sys.exit(1)
コード例 #5
0
#!/usr/bin/env python

from sensor import log
from sensor import functions
from sensor import excepts

# make sure we have an empty network config
functions.sensorDown()

# remove old stuff, maybe sensor crashed or something
functions.cleanUp()

try:
    functions.sensorUp()
except excepts.NetworkException:
    logging.error("some problems; please see logfile")
コード例 #6
0
#!/usr/bin/env python

from sensor import log
from sensor import functions
from sensor import excepts

# make sure we have an empty network config
functions.sensorDown()

# remove old stuff, maybe sensor crashed or something
functions.cleanUp()

functions.networkUp()