diff --git a/.gitignore b/.gitignore index b4fa041..ae9c138 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ operationsdb.json docker_client_config -_build/ \ No newline at end of file +_build/ + +dist/* +*egg-* \ No newline at end of file diff --git a/setup.py b/setup.py index ddad8ac..aa9d191 100644 --- a/setup.py +++ b/setup.py @@ -40,6 +40,8 @@ def load_requirements(filename='requirements.txt'): package_dir={"": "src"}, packages=find_packages(where="src"), install_requires=load_requirements(), + use_scm_version=True, + setup_requires=['setuptools_scm'], entry_points={ 'console_scripts': [ 'DOLOST = DOLOST.cli:main' diff --git a/src/DOLOST/services/activity.py b/src/DOLOST/services/activity.py index 7c3656d..b3d0123 100644 --- a/src/DOLOST/services/activity.py +++ b/src/DOLOST/services/activity.py @@ -73,19 +73,22 @@ def review_observable_ips(): # Start streaming the output of the command for line in docker_manager.client.api.exec_start(exec_id['Id'], stream=True): decoded_line = line.decode('utf-8') - if "No such file or directory" in decoded_line : - new_ip = '{"id": 1, "decoy": "---", "ip": "No IPs","timestamp": "----" }' - observable_ips.append(new_ip) - else: - records = decoded_line.strip().split('\r\n') - # Process each record - i = 1 - for record in records: - # Split each record by space to separate the timestamp and the IP address - timestamp, decoy, ip_address = record.split(',') - if (ip_address not in excluded_observable_ips): - observable_ips.append('{"id": '+ str(i) +', "decoy": "'+ decoy +'", "ip": "'+ ip_address +'", "timestamp": "' + timestamp + '"}') - i = i + 1 + try: + if "No such file or directory" in decoded_line : + new_ip = '{"id": 1, "decoy": "---", "ip": "No IPs","timestamp": "----" }' + observable_ips.append(new_ip) + else: + records = decoded_line.strip().split('\r\n') + # Process each record + i = 1 + for record in records: + # Split each record by space to separate the timestamp and the IP address + timestamp, decoy, ip_address = record.split(',') + if (ip_address not in excluded_observable_ips): + observable_ips.append('{"id": '+ str(i) +', "decoy": "'+ decoy +'", "ip": "'+ ip_address +'", "timestamp": "' + timestamp + '"}') + i = i + 1 + except Exception: + pass else: new_ip = '{"id": 1, "decoy": "---", "ip": "Missing Collector","timestamp": "----" }' observable_ips.append(new_ip) @@ -119,18 +122,22 @@ def review_observable_usage(): # Start streaming the output of the command for line in docker_manager.client.api.exec_start(exec_id['Id'], stream=True): decoded_line = line.decode('utf-8') - if "No such file or directory" in decoded_line : - new_data = '{"id": 1, "decoy": "No Usage data","usage": "----" }' - observable_usage.append(new_data) - else: - records = decoded_line.strip().split('\r\n') - # Process each record - i = 1 - for record in records: - # Split each record by space to separate the timestamp and the IP address - usage, decoy = record.split(',') - observable_usage.append('{"id": '+ str(i) +', "decoy": "'+ decoy +'", "usage": "' + usage + '"}') - i = i + 1 + try: + if "No such file or directory" in decoded_line : + new_data = '{"id": 1, "decoy": "No Usage data","usage": "----" }' + observable_usage.append(new_data) + else: + records = decoded_line.strip().split('\r\n') + # Process each record + i = 1 + for record in records: + # Split each record by space to separate the timestamp and the IP address + usage, decoy = record.split(',') + observable_usage.append('{"id": '+ str(i) +', "decoy": "'+ decoy +'", "usage": "' + usage + '"}') + i = i + 1 + except Exception: + pass + else: new_ip = '{"id": 1, "decoy": "Missing Collector","usage": "----" }' observable_usage.append(new_ip) diff --git a/src/DOLOST/static/js/view_activities_worker.js b/src/DOLOST/static/js/view_activities_worker.js index 0ba63b0..4bca7fe 100644 --- a/src/DOLOST/static/js/view_activities_worker.js +++ b/src/DOLOST/static/js/view_activities_worker.js @@ -39,9 +39,9 @@ function updateUI(logs) { const logListModal = document.getElementById('logListModal'); // Iterate over logs and append only new ones + logList.innerHTML = ''; + logListModal.innerHTML = ''; logs.forEach(log => { - logList.innerHTML = ''; - logListModal.innerHTML = ''; const listItem = document.createElement('p'); listItem.textContent = log; listItem.classList.add('log-line');