Commit a406ab24 authored by Jan Pavlinec's avatar Jan Pavlinec

ludus: update to version 0.9

parent 8f5ba145
......@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ludus
PKG_VERSION:=0.8
PKG_RELEASE:=3
PKG_VERSION:=0.9
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/stratosphereips/Ludus.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=20ab147a4f112a331d786cb22f3deeef5e12382d
PKG_SOURCE_VERSION:=a68f5a86bda1b0deffe79459c6f46a0501e65791
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
......@@ -79,6 +79,7 @@ define Package/ludus/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/{ludus.py,install.py} $(1)/usr/share/ludus/
$(INSTALL_DIR) $(1)/etc/ludus
$(CP) ./files/ludus_template.conf $(1)/etc/ludus/
$(CP) $(PKG_BUILD_DIR)/ludus-public-key.asc $(1)/etc/ludus/
$(INSTALL_DIR) $(1)/etc/ludus/strategy
$(CP) $(PKG_BUILD_DIR)/Strategizer/strategies/* $(1)/etc/ludus/strategy/
$(INSTALL_DIR) $(1)/etc/init.d
......
......@@ -9,6 +9,7 @@ local_stats = /tmp/ludus_local_data.pkl
[strategy]
strategy_dir = /etc/ludus/strategy
filename = secConfDefAtt_1516886661989_-1HPsalgzerosum-bayes-relevant-NE-partial-att-strategy_Ports25
strategy_url = http://ludus.aic.fel.cvut.cz/newest.gpg
[suricata]
interface = eth1
......
Index: ludus-0.6/ludus.py
Index: ludus-0.9/ludus.py
===================================================================
--- ludus-0.6.orig/ludus.py
+++ ludus-0.6/ludus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
# Copyright (C) 2017 Sebastian Garcia, Ondrej Lukas
#
# This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
#TODO:
# changes in suricata.yaml!
# check if sentinel is running !
--- ludus-0.9.orig/ludus.py
+++ ludus-0.9/ludus.py
@@ -39,6 +39,7 @@ import Suricata_Extractor.suricata_extra
from multiprocessing import Process
from argparse import ArgumentParser
from configparser import ConfigParser,NoOptionError
+import configparser
import time,datetime
import sys
import subprocess
@@ -86,7 +87,7 @@ class Logger():
def log_event(self, msg):
with open(self._target_file, "a") as out_file:
print(f"[{datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S.%f')}]\t{msg}", file=out_file)
-
+
def update_target_file(self, filename):
self._target_file = filename
@@ -165,7 +166,7 @@ class Ludus(object):
if r.status_code == 200:
last_modified_url = r.headers["Last-Modified"].strip('\"')
last_modified_url_dt = datetime.datetime.utcfromtimestamp(datetime.datetime.strptime(last_modified_url, "%a, %d %b %Y %H:%M:%S %Z").replace(tzinfo=datetime.timezone.utc).timestamp())
-
+
current_strategy_dt = datetime.datetime.utcfromtimestamp(self.strategy_timestamp.replace(tzinfo=datetime.timezone.utc).timestamp())
#compare the timestamps
if current_strategy_dt < last_modified_url_dt:
@@ -227,7 +228,7 @@ class Ludus(object):
self.tw_length = 600
except ValueError:
self.tw_length = 600
- #get router ip
+ #get router ip
try:
self.router_ip = self.config_parser.get('settings', 'router_ip')
if not valid_ip4(self.router_ip):
@@ -270,7 +271,7 @@ class Ludus(object):
self.strategy_url = self.config_parser.get("strategy","strategy_url")
except (ValueError, NoOptionError) as e:
self.strategy_url = "http://ludus.aic.fel.cvut.cz:443/newest.gpg"
-
+
def apply_strategy(self, suggested_honeypots,known_honeypots=['22', '23', '8080', '2323', '80', '3128', '8123']):
#close previously opened HP which we do not want anymore
try:
@@ -395,8 +396,8 @@ class Ludus(object):
self.suricata_pid = suricata_process.pid
if not self.suricata_pid:
self.logger.log_event(f"Error while starting suricata: {proc.stderr.read()}")
- self.terminate(-1)
-
+ self.terminate(-1)
+
#start
self.logger.log_event("Ludus system started.")
#analyze the production ports
@@ -426,14 +427,14 @@ class Ludus(object):
else:
self.logger.log_event("Terminating Ludus.")
sys.exit(status)
-
+
if __name__ == '__main__':
# Parse the parameters
parser = ArgumentParser()
parser.add_argument('-c', '--config', help='Path to config file', action='store', required=False, type=str, default="/etc/ludus/ludus.config")
parser.add_argument('--pidfile', help='Path to create pid file', action='store', required=False, type=str)
args = parser.parse_args()
-
+
if args.pidfile:
write_pid_file(args.pidfile)
#start the tool
@@ -441,4 +442,4 @@ if __name__ == '__main__':
try:
ludus.start()
except KeyboardInterrupt:
- ludus.terminate(0)
\ No newline at end of file
+ ludus.terminate(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment