From ee28118715f75648fb2aa9d4750a5b65bdc2e382 Mon Sep 17 00:00:00 2001 From: farsight Date: Tue, 24 Dec 2024 13:14:32 +0200 Subject: [PATCH] Delete session functionality (#590) --- conpot/core/__init__.py | 3 +++ conpot/core/session_manager.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/conpot/core/__init__.py b/conpot/core/__init__.py index a63f7891..8622cdf0 100644 --- a/conpot/core/__init__.py +++ b/conpot/core/__init__.py @@ -41,6 +41,9 @@ def get_databus(): def get_session(*args, **kwargs): return sessionManager.get_session(*args, **kwargs) +def delete_session(*args, **kwargs): + return sessionManager.delete_session(*args, **kwargs) + # file-system related -- diff --git a/conpot/core/session_manager.py b/conpot/core/session_manager.py index 084e1e56..170c6f83 100644 --- a/conpot/core/session_manager.py +++ b/conpot/core/session_manager.py @@ -55,6 +55,12 @@ def get_session( self._sessions.append(attack_session) return attack_session + def delete_session(self, id): + for i, session in enumerate(self._sessions): + if session.id == id: + del self._sessions[i] + break + def purge_sessions(self): # there is no native purge/clear mechanism for gevent queues, so... self.log_queue = Queue()