Ejemplo n.º 1
0
def new():
    global g_handler_configs
    logger.info("Load iHandlers")
    load_submodules()

    module_config = g_dionaea.config().get("module")
    filename_patterns = module_config.get("ihandler_configs", [])
    g_handler_configs = load_config_from_files(filename_patterns)
Ejemplo n.º 2
0
def new():
    global g_slave
    global g_service_configs

    logger.info("Initializing services ...")
    dionaea_config = g_dionaea.config().get("dionaea")

    mode = dionaea_config.get("listen.mode")
    interface_names = dionaea_config.get("listen.interfaces")

    if mode == 'manual':
        addrs = {}

        addresses = dionaea_config.get("listen.addresses")
        ifaces = g_dionaea.getifaddrs()
        for iface in ifaces.keys():
            afs = ifaces[iface]
            for af in afs.keys():
                if af == 2 or af == 10:
                    configs = afs[af]
                    if iface not in addrs:
                        addrs[iface] = []
                    for config in configs:
                        if config["addr"] in addresses:
                            addrs[iface].append(config['addr'])
        g_slave = slave(addresses=addrs)
    elif mode == 'getifaddrs':
        ifaces = g_dionaea.getifaddrs()
        addrs = {}
        for iface in ifaces.keys():
            if interface_names is not None and iface not in interface_names:
                logger.debug("Skipping interface %s. Not in interface list.",
                             iface)
                continue
            afs = ifaces[iface]
            for af in afs.keys():
                if af == 2 or af == 10:
                    configs = afs[af]
                    for config in configs:
                        if iface not in addrs:
                            addrs[iface] = []
                        addrs[iface].append(config['addr'])
        g_slave = slave(addresses=addrs)
    elif mode == 'nl':
        # ToDo: handle error if ifaces is None
        g_slave = nlslave(ifaces=interface_names)

    load_submodules()

    module_config = g_dionaea.config().get("module")
    filename_patterns = module_config.get("service_configs", [])
    g_service_configs = load_config_from_files(filename_patterns)
Ejemplo n.º 3
0
def new():
    print("START")
    global g_slave
    global g_service_configs
    dionaea_config = g_dionaea.config().get("dionaea")

    mode = dionaea_config.get("listen.mode")
    interface_names = dionaea_config.get("listen.interfaces")

    if mode == 'manual':
        addrs = {}

        addresses = dionaea_config.get("listen.addresses")
        ifaces = g_dionaea.getifaddrs()
        for iface in ifaces.keys():
            afs = ifaces[iface]
            for af in afs.keys():
                if af == 2 or af == 10:
                    configs = afs[af]
                    if iface not in addrs:
                        addrs[iface] = []
                    for config in configs:
                        if config["addr"] in addresses:
                            addrs[iface].append(config['addr'])
        g_slave = slave(addresses=addrs)
    elif mode == 'getifaddrs':
        ifaces = g_dionaea.getifaddrs()
        addrs = {}
        for iface in ifaces.keys():
            if interface_names is not None and iface not in interface_names:
                logger.debug("Skipping interface %s. Not in interface list.", iface)
                continue
            afs = ifaces[iface]
            for af in afs.keys():
                if af == 2 or af == 10:
                    configs = afs[af]
                    for config in configs:
                        if iface not in addrs:
                            addrs[iface] = []
                        addrs[iface].append(config['addr'])
        print(addrs)
        g_slave = slave(addresses=addrs)
    elif mode == 'nl':
        # ToDo: handle error if ifaces is None
        g_slave = nlslave(ifaces=interface_names)

    load_submodules()

    module_config = g_dionaea.config().get("module")
    filename_patterns = module_config.get("service_configs", [])
    g_service_configs = load_config_from_files(filename_patterns)