Skip to content

Commit

Permalink
Version 2.5!
Browse files Browse the repository at this point in the history
Upgrade to version 2.5 of the T3SF framework for exciting new features, bug fixes, and an enhanced user experience. This release introduces the MSEL Playground, Dark mode, a Database with AI-generated Events, and much more!

- Introducing the MSEL Playground, providing real-time editing capabilities for MSEL files.
  - Added support for uploading .xls/.xlsx files and converting them to JSON format.
  - Implemented the ability to save modified or converted MSEL files.
- Refreshed the nav-bar style for an improved visual experience.
- Created a new static folder for local web resources.
  - Modified the source for certain images used in the application.
- Added a function to set the Discord server ID.
- Introduced a Dark mode option.
- Implemented a Database with AI-generated Events.
- Included a FAQ section addressing common TTX design questions.
- Added a Platform indicator on the GUI.
- Expanded the poll options to support more choices.
- Added "Resume," "Pause," and "Abort" buttons on the GUI.
- Swapped the functionality of the "Stop" and "Abort" buttons.
- Included a random data generator button for the MSEL.
- Added a Database with comprehensive example scenarios.
- Improved clarity of script execution explanations.

- Fixed a bug in the log viewer where the "Framework status" text wouldn't display without available logs.
- Rewrote the log display to address visual issues when selecting or when logs were too long.
- Resolved an issue where exception messages were not properly displayed on the GUI.
  • Loading branch information
lanfranB4 committed Aug 2, 2023
1 parent 9d0f1c8 commit 014df31
Show file tree
Hide file tree
Showing 44 changed files with 40,617 additions and 430 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.5] - 2023-08-02
Upgrade to version 2.5 of the T3SF framework for exciting new features, bug fixes, and an enhanced user experience. This release introduces the MSEL Playground, Dark mode, a Database with AI-generated Events, and much more!

### New
- Introducing the MSEL Playground, providing real-time editing capabilities for MSEL files.
- Added support for uploading .xls/.xlsx files and converting them to JSON format.
- Implemented the ability to save modified or converted MSEL files.
- Refreshed the nav-bar style for an improved visual experience.
- Created a new static folder for local web resources.
- Modified the source for certain images used in the application.
- Added a function to set the Discord server ID.
- Introduced a Dark mode option.
- Implemented a Database with AI-generated Events.
- Included a FAQ section addressing common TTX design questions.
- Added a Platform indicator on the GUI.
- Expanded the poll options to support more choices.
- Added "Resume," "Pause," and "Abort" buttons on the GUI.
- Swapped the functionality of the "Stop" and "Abort" buttons.
- Included a random data generator button for the MSEL.
- Added a Database with comprehensive example scenarios.
- Improved clarity of script execution explanations.

### Fixes
- Fixed a bug in the log viewer where the "Framework status" text wouldn't display without available logs.
- Rewrote the log display to address visual issues when selecting or when logs were too long.
- Resolved an issue where exception messages were not properly displayed on the GUI.

## [2.1] - 2023-06-02
Upgrade to version 2.1 of the T3SF framework to benefit from an array of new features, bug fixes, and enhanced stability. This release brings important updates and automation to streamline various processes within the framework.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</div>
<div align="center">

[![Docker Image for Discord](https://github.com/Base4Security/T3SF/actions/workflows/publish_discord.yml/badge.svg)](https://github.com/Base4Security/T3SF/actions/workflows/publish_discord.yml)
[![Docker Image for Slack](https://github.com/Base4Security/T3SF/actions/workflows/publish_slack.yml/badge.svg)](https://github.com/Base4Security/T3SF/actions/workflows/publish_slack.yml)
[![Docker Image for Discord](https://github.com/Base4Security/T3SF/actions/workflows/publish_discord.yml/badge.svg)](https://hub.docker.com/r/base4sec/t3sf)
[![Docker Image for Slack](https://github.com/Base4Security/T3SF/actions/workflows/publish_slack.yml/badge.svg)](https://hub.docker.com/r/base4sec/t3sf)
</div>

<p align="center"> Technical Tabletop Exercises Simulation Framework
Expand Down
45 changes: 24 additions & 21 deletions T3SF/T3SF.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ def keyboard_interrupt_handler(signal_num, frame):
# Associate the signal handler function with SIGINT (keyboard interrupt)
signal.signal(signal.SIGINT, keyboard_interrupt_handler)


class T3SF(object):
def __init__(self, bot = None, app = None, platform = None):
self.response = None
self.process_wait = False
self.process_quit = False
self.regex_ready = None
self.incidents_running = False
self.poll_answered = False
Expand Down Expand Up @@ -85,8 +82,6 @@ async def TimeDifference(self, actual_real_time, previous_real_time, itinerator=
await self.NotifyGameMasters(type_info="poll_unanswered", data={'msg_poll':self._inject["Script"]})

except Exception as e:
print("Get Time Difference")
print(e)
T3SF_Logger.emit("Get Time Difference", message_type="ERROR")
T3SF_Logger.emit(e, message_type="ERROR")
raise
Expand All @@ -113,7 +108,7 @@ async def start(MSEL:str, platform, gui=False):
if gui == True:
T3SF_Logger.emit(message="Starting GUI", message_type="DEBUG")
gui_module = importlib.import_module("T3SF.gui.core")
gui_module.GUI(platform_run=platform, MSEL=MSEL)
gui_module.GUI(platform_run=platform, MSEL=MSEL, static_url_path='/static', static_folder='static')

if platform.lower() == "slack":
bot_module = importlib.import_module("T3SF.slack.bot")
Expand Down Expand Up @@ -172,8 +167,6 @@ async def NotifyGameMasters(self, type_info=str, data=None):
return True

except Exception as e:
print("NotifyGameMasters")
print(e)
T3SF_Logger.emit("NotifyGameMasters", message_type="ERROR")
T3SF_Logger.emit(e, message_type="ERROR")
raise
Expand All @@ -199,12 +192,10 @@ async def ProcessIncidents(self, MSEL:str, ctx, function_type:str=None, itinerat
bypass_time = True

for information in self.data:
if self.process_quit == True:
process_status = await self.check_status()

if process_status == 'break':
break

if self.process_wait == True:
while self.process_wait == True:
await asyncio.sleep(5)

if itinerator == 0: # Set a variable to get the actual timestamp and the past one, after that checks for differences.
itinerator_loop = itinerator
Expand Down Expand Up @@ -248,18 +239,34 @@ async def ProcessIncidents(self, MSEL:str, ctx, function_type:str=None, itinerat

itinerator += 1

await self.check_status(reset=True)
await self.NotifyGameMasters(type_info="finished_incidents") # Informs that the script is completed and there's no remaining incidents.
self.process_quit = False
self.process_wait = False
self.incidents_running = False

except Exception as e:
print("ProcessIncidents function")
print(e)
T3SF_Logger.emit("ProcessIncidents function", message_type="ERROR")
T3SF_Logger.emit(e, message_type="ERROR")
raise

async def check_status(self, reset:bool = False):
from .utils import process_wait, process_quit

if reset:
process_quit = False
process_wait = False
return True

if process_quit == True:
return 'break'

if process_wait == True:
# print(f"We are waiting, because the variable {process_wait} is set to True")
await asyncio.sleep(5)
await self.check_status()
return False

return True

async def SendIncident(self, inject):
try:
self._inject = inject
Expand All @@ -273,8 +280,6 @@ async def SendIncident(self, inject):
return True

except Exception as e:
print("SendIncident")
print(e)
T3SF_Logger.emit("SendIncident", message_type="ERROR")
T3SF_Logger.emit(e, message_type="ERROR")
raise
Expand All @@ -292,8 +297,6 @@ async def SendPoll(self, inject):
return True

except Exception as e:
print("SendPoll")
print(e)
T3SF_Logger.emit("SendPoll", message_type="ERROR")
T3SF_Logger.emit(e, message_type="ERROR")
raise
Expand Down
11 changes: 8 additions & 3 deletions T3SF/discord/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import random
import json
import re
from T3SF import utils
from T3SF import utils, T3SF_Logger

class Discord(object):
def __init__(self, bot):
Expand Down Expand Up @@ -62,11 +62,14 @@ async def InboxesAuto(self, T3SF_instance):
past_channel = category.name
pass

T3SF_Logger.emit(message=f'Please confirm the Regular Expression for the inboxes on the gm-chat!', message_type="INFO")

await T3SF_instance.response_auto.edit(embed=discord.Embed(
title = "ℹ️ Regex detected!",
description = f"Please confirm if the regex detected for the channels, is correct so we can get the inboxes!\n\nExample:\nGroup - Legal\nThe regex should be `Group -`\n\nDetected regex: `{regex}`",
color = 0x77B255).set_image(url=image_example).set_footer(text="Please answer with [Yes(Y)/No(N)]"))


def check_regex_channels(msg):
if started_from_gui:
return msg.content.lower() in ["y", "yes", "n", "no"]
Expand Down Expand Up @@ -120,6 +123,8 @@ def get_regex_channels(msg_regex_user):

await self.EditMessage(T3SF_instance=T3SF_instance, style="custom", variable="T3SF_instance.response_auto", color="GREEN", title=f"📩 Inboxes fetched! [{len(T3SF_instance.inboxes_all)}]", description=mensaje_inboxes)

T3SF_Logger.emit(message=f'Confirmed! Inboxes ready', message_type="INFO")

return True

async def InjectHandler(self, T3SF_instance):
Expand Down Expand Up @@ -168,8 +173,8 @@ async def PollHandler(self, T3SF_instance):
diff_secs = diff * 60

view = discord.ui.View()
view.add_item(discord.ui.Button(style=discord.ButtonStyle.primary,label=poll_options[0], custom_id="poll|"+poll_options[0]))
view.add_item(discord.ui.Button(style=discord.ButtonStyle.primary,label=poll_options[1], custom_id="poll|"+poll_options[1]))
for option in poll_options:
view.add_item(discord.ui.Button(style=discord.ButtonStyle.primary, label=option, custom_id="poll|" + option))

all_data = all_data+ f"\n\nYou have {diff} minute(s) to answer this poll!"

Expand Down
Loading

0 comments on commit 014df31

Please sign in to comment.