if service_config.get(service, 'enabled') == 'Yes': [low_protocol, low_port] = service_config.get(service, 'low_port').split(':') [protocol, port] = service_config.get(service, 'port').split(':') if int(low_port) < 1024: ipt_file.write('./ipt_set_' + low_protocol + ' ' + low_port + ' ' + port + ' $1\n') # set file permission, close, and quit os.chmod(ipt_file_name, 0744) ipt_file.close() quit() # tail log file when reactor runs tailer = HoneyPyLogTail(log_path + log_file_name) tailer.config = honeypy_config tailer.config.set('honeypy', 'useragent', 'HoneyPy (' + version + ')') tailer.start() log.msg(tailer.config.get('honeypy', 'useragent') + " Started") for section in tailer.config.sections(): if section != 'honeypy' and tailer.config.get(section, 'enabled').lower() == 'yes': log.msg("Enabled Logger : %s" % (section)) # services object array services = [] services.append([]) services.append([])
# start logging log.startLoggingWithObserver(file_log_observer.emit, False) if honeypy_config.get('twitter', 'enabled') == 'Yes' or \ honeypy_config.get('honeydb', 'enabled') == 'Yes' or \ honeypy_config.get('slack', 'enabled') == 'Yes' or \ honeypy_config.get('logstash', 'enabled') == 'Yes' or \ honeypy_config.get('elasticsearch', 'enabled') == 'Yes' or \ honeypy_config.get('telegram', 'enabled') == 'Yes' or \ honeypy_config.get('rabbitmq', 'enabled') == 'Yes' or \ honeypy_config.get('sumologic', 'enabled') == 'Yes' or \ honeypy_config.get('splunk', 'enabled'): # tail log file when reactor runs tailer = HoneyPyLogTail(log_path + log_file_name) tailer.config = honeypy_config tailer.useragent = 'HoneyPy (' + version + ')' tailer.start() # services object array services = [] services.append([]) services.append([]) # start enabled services display_low_port_message = True def get_ip_address(): # function to ensure we get external IP (rather than hostname) for udp connections.
for service in service_config.sections(): if service_config.get(service, 'enabled') == 'Yes': [low_protocol, low_port] = service_config.get(service, 'low_port').split(':') [protocol, port] = service_config.get(service, 'port').split(':') if int(low_port) < 1024: ipt_file.write('./ipt_set_' + low_protocol + ' ' + low_port + ' ' + port + ' $1\n') # set file permission, close, and quit os.chmod(ipt_file_name, 0744) ipt_file.close() quit() # tail log file when reactor runs tailer = HoneyPyLogTail(os.path.join(log_path, log_file_name)) tailer.config = honeypy_config tailer.config.set('honeypy', 'useragent', 'HoneyPy (' + version + ')') # set persistent logger connections for section in tailer.config.sections(): if tailer.config.has_option(section, 'persistent') and tailer.config.get(section, 'persistent').lower() == 'yes' and tailer.config.get(section, 'enabled').lower() == 'yes': module_name = "loggers.%s.honeypy_%s" % (section, section) logger_module = importlib.import_module(module_name) tailer.persistent_conns[section] = logger_module.conn(tailer.config, section) tailer.start() log.msg(tailer.config.get('honeypy', 'useragent') + " Started") for section in tailer.config.sections(): if section != 'honeypy' and tailer.config.get(section, 'enabled').lower() == 'yes':