diff --git a/LICENSE b/LICENSE index fdddb29..0f0c86a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,24 +1,21 @@ -This is free and unencumbered software released into the public domain. +MIT License -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. +Copyright (c) 2025 DEFENSE INTELLIGENCE AGENCY • PROJECT RED SWORD -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -For more information, please refer to +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py index 5a9d828..3a0d1f6 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py +++ b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py @@ -9,7 +9,7 @@ SERVER_HOST = '0.0.0.0' SERVER_PORT = 1025 saveMail_directory = "FlowSteering/ApplicationCode/LLaVaServer/EmailLLaVaMailDatabase" -MODEL_NAME = "FlowSteering/llava/llava_weights/" # PATH to the LLaVA weights +MODEL_NAME = "FlowSteering/llava/llava_weights/" # PATH to the LLaVa weights message_queue = Queue() # Server configuration @@ -33,7 +33,10 @@ def receive_complete_data( except socket.timeout as e: print('timeout') print(e) - + pass + except socket.error as e: + print('socket error') + print(e) pass return received_data @@ -70,9 +73,9 @@ def SendToLLaVa(data, client_socket, sender, recipient, subject, model, image_pr for part in msg.get_payload(): if part.get_content_type() == "text/plain": body = part.get_payload() - else: - print(msg.get_payload()) + body = msg.get_payload() + # print the subject for part in msg.walk(): if part.get_content_maintype() == "multipart": @@ -124,7 +127,11 @@ def SendToLLaVa(data, client_socket, sender, recipient, subject, model, image_pr def start_server(): # This function is used to start the server and listen for incoming connections server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server_socket.bind((SERVER_HOST, SERVER_PORT)) + try: + server_socket.bind((SERVER_HOST, SERVER_PORT)) + except socket.error as e: + print(f"Error binding server socket: {e}") + return server_socket.listen(1000) model, image_processor, tokenizer, device = Run_LLaVa.Turn_On_LLaVa() # Turn on the LLaVa model and get the model, image processor, tokenizer and the device diff --git a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py index 2e7cd05..5baeb4c 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py +++ b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py @@ -77,7 +77,11 @@ def load_image(image_file): response = requests.get(image_file) image = Image.open(BytesIO(response.content)).convert('RGB') else: - image = Image.open(image_file).convert('RGB') + try: + image = Image.open(image_file).convert('RGB') + except Exception as e: + print(f"Error loading image: {e}") + return None return image @@ -169,6 +173,8 @@ def generate_stream(model, prompt, tokenizer, input_ids, images=None): def run_result(X, prompt, initial_query, query_list, model, tokenizer, unnorm, image_processor): device = 'cuda' X = load_image(X) + if X is None: + return ["Error loading image"] print("Image: ") # load the image @@ -234,8 +240,13 @@ def Turn_On_LLaVa(): # Load the LLaVa model tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) dtypePerDevice = torch.float16 - model = LlavaLlamaForCausalLM.from_pretrained(model_name, low_cpu_mem_usage=True, torch_dtype=dtypePerDevice, - use_cache=True) + try: + model = LlavaLlamaForCausalLM.from_pretrained(model_name, low_cpu_mem_usage=True, torch_dtype=dtypePerDevice, + use_cache=True) + except Exception as e: + print(f"Error loading model: {e}") + return None, None, None, None + model.to(device=device, dtype=dtypePerDevice) image_processor = CLIPImageProcessor.from_pretrained(model.config.mm_vision_tower) @@ -264,7 +275,11 @@ def Turn_On_LLaVa(): # Load the LLaVa model def load_param(MODEL_NAME, model, tokenizer, initial_query): model_name = os.path.expanduser(MODEL_NAME) - image_processor = CLIPImageProcessor.from_pretrained(model.config.mm_vision_tower) + try: + image_processor = CLIPImageProcessor.from_pretrained(model.config.mm_vision_tower) + except Exception as e: + print(f"Error loading image processor: {e}") + return None, None, None, None, None, None, None, None, None mm_use_im_start_end = getattr(model.config, "mm_use_im_start_end", False) tokenizer.add_tokens([DEFAULT_IMAGE_PATCH_TOKEN], special_tokens=True) diff --git a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/README.md b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/README.md index 3b21e29..55f150d 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/README.md +++ b/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/README.md @@ -8,9 +8,6 @@ In this directory, you will find the code for the GenAI EcoSystem. The GenAI EcoSystem consists of a collection of scripts designed to simulate an email system with multiple users and dedicated servers. - - - The system consists of three main components: the Email Server, the LLaVa Server, and the End User Clients. * The Email Server is responsible for sending and receiving emails from the End User Clients. * The LLaVa Server is the GenAI service responsible for handling the emails that were sent to the End User Clients. @@ -25,9 +22,6 @@ The system consists of three main components: the Email Server, the LLaVa Server In our experiments, we utilized a single machine to run both the Email Server and the LLaVa Server. This machine was equipped with a single NVIDIA Quadro RTX 6000 24GB GPU. Additionally, we employed seven virtual machines to run the End User Clients. - - - ## Running the GenAI EcoSystem ### 1. Run the Email Server @@ -37,7 +31,7 @@ file to set the server configuration. ```python SERVER_HOST = '0.0.0.0' # Change this to the IP address of the machine where the Email Server will run SERVER_PORT = 1234 # Change this to the port where the Email Server will listen -saveMail_directory = "FlowSteering/ApplicationCode/EmailServer/Database/EmailServerMailDatabase" # Change this to the directory where you want to save the emails inbox for each user +saveMail_directory = "FlowSteering/ApplicationCode/EmailServer/EmailServerMailDatabase" # Change this to the directory where you want to save the emails inbox for each user message_queue = Queue() default_image = 'FlowSteering/assets/PerturbatedImages/DjiPerturbClassForward.png' ``` @@ -59,9 +53,6 @@ def handle_messages(): Save_Email_To_Recipient() ``` - - - #### To run the Email Server execute the following command in the EmailServer directory ```bash python3 EmailServer.py @@ -92,9 +83,6 @@ def handle_messages(): SendToLLaVa() ``` - - - #### To run the LLaVa Server execute the following command in the LLaVaServer directory ```bash python3 LLaVaServer.py @@ -109,16 +97,12 @@ Since this script is designed to run on multiple machines, you don't need to edi You can find an example of the CSV file named: [EndUserBaseEmails.csv](../../FlowSteering/ApplicationCode/EndUserCode/EndUserClientBaseEmails/EndUserBaseEmails.csv). The function responsible for reading this CSV file is located in the [EndUserClient.py](../../FlowSteering/ApplicationCode/EndUserCode/EndUserClient.py) file under the respective function. - ```python def read_emails_from_file(): ``` - - The script for each End User Client runs in a loop, sending a request to the Email Server to check the inbox for new emails every 10-20 seconds. - ```python def main(): while True: @@ -129,9 +113,6 @@ def main(): If there is a new email in the inbox, the Email server will send the email to the End User Client, and a pop-up window will appear with the email content. Next the End User Client will send the email to the LLaVa Server for classification, and the LLaVa Server will send the classification back to the End User Client. - - - | Pop-up Window | Queries sent to LLaVa | |---------------------------------------------|-----------------------------------------------------| | ![Image 1 Description](../../Assets/DJISpam.png) | ![Image 2 Description](../../Assets/LLaVaQuery.png) | @@ -140,9 +121,6 @@ Finally, the End User Client will act based on the classification returned by th For our experiments, we implemented the action "Forward" and left the other actions as placeholders. - - - ```python if Classification == 'reply': print('Manual action is required for replying to this email, so it will be transferred to the Manual Folder.') @@ -157,10 +135,8 @@ For our experiments, we implemented the action "Forward" and left the other acti elif Classification == 'spam': print('Moving the email to the Spam Folder') pass - ``` - #### To run the End User Client execute the following command in the EndUserCode directory and replace the configurations of the server and the user with your own configurations ```bash python3 EndUserClient.py --SERVER_EMAIL_HOST 111.88.88.33 --SERVER_EMAIL_PORT 1234 --SERVER_LLAVA_HOST 111.55.55.33 --SERVER_LLAVA_PORT 1025 --MYEMAIL Person1@example.com --saveMail_directory "FlowSteering/ApplicationCode/EndUserCode/EndUserPersonalEmailDir" --BaseEmails_directory "FlowSteering/ApplicationCode/EndUserCode/EndUserClientBaseEmails/EndUserBaseEmails.csv" --CycleNewEmails True --default_image "FlowSteering/assets/PerturbatedImages/DjiPerturbClassForward.png" @@ -172,9 +148,6 @@ Navigate to the [EndUserCode directory](../../FlowSteering/ApplicationCode/EndUs This code is a simplified version of the End User Client, used solely to send the initial malicious email to the End User Clients, as they are not composing new emails. - - - Configure the following variables to send the email: ``` python def main(): @@ -195,25 +168,28 @@ Next, the Attacker Client will send two identical emails to the Email Server, wi SERVER_EMAIL_PORT) ``` - - - #### To run the Attacker Client execute the following command in the EndUserCode directory and replace the configurations of the server and the user with your own configurations ```bash python3 AttackerClient.py --SERVER_EMAIL_HOST 111.88.88.33 --SERVER_EMAIL_PORT 1234 --SERVER_LLAVA_HOST 111.55.55.33 --SERVER_LLAVA_PORT 1025 --MYEMAIL Attacker@example.com ``` - ## Conclusion In our experiments, we developed a basic GenAI email application consisting of several components. You are welcome to modify any part of the system and tailor it to your own requirements and preferences. +## Recent Changes and Additions +We have recently made several updates and additions to the codebase to enhance the functionality and performance of the GenAI EcoSystem. These changes include: +1. **Improved Network Handling**: Enhanced the network handling capabilities to address issues related to image transmission over sockets, especially when using virtual machines. A default image is now loaded when an image fails to send correctly due to network issues. +2. **Optimized Email Server**: Refined the Email Server's handling of incoming connections and email storage. The server now creates a directory to save the email inbox for each user, ensuring better organization and retrieval of emails. +3. **Enhanced LLaVa Server**: Updated the LLaVa Server to process incoming emails more efficiently using the LLaVa model. The server now listens for incoming connections, processes emails, and sends responses back to the End User Clients seamlessly. +4. **End User Client Improvements**: Improved the End User Client script to run in a loop, checking the inbox for new emails every 10-20 seconds. The script now handles email classification and actions based on the classification returned by the LLaVa Server. +5. **Attacker Client Simplification**: Simplified the Attacker Client script to send the initial malicious email to the End User Clients. The script now sends two identical emails to the Email Server, targeting specific recipients. - +These updates aim to provide a more robust and efficient GenAI EcoSystem, ensuring smooth communication and interaction between the various components. diff --git a/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt b/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt index 35197ff..02eda04 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt +++ b/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt @@ -1,6 +1,6 @@ einops fastapi -gradio==5.5.0 +gradio==5.11.0 markdown2[all] numpy requests @@ -12,7 +12,7 @@ uvicorn wandb shortuuid httpx==0.24.0 -deepspeed==0.9.5 +deepspeed==0.15.1 peft==0.4.0 transformers==4.38.0 accelerate==0.21.0 diff --git a/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml b/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml index 3388c27..ab36207 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml +++ b/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml @@ -13,11 +13,11 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", ] dependencies = [ - "einops", "fastapi", "gradio==5.5.0", "markdown2[all]", "numpy", + "einops", "fastapi", "gradio==5.11.0", "markdown2[all]", "numpy", "requests", "sentencepiece", "tokenizers>=0.12.1", "torch", "torchvision", "uvicorn", "wandb", "shortuuid", "httpx==0.24.0", - "deepspeed==0.9.5", + "deepspeed==0.15.1", "peft==0.4.0", "transformers==4.38.0", "accelerate==0.21.0", diff --git a/advanced-zero-click-deployment-interface/FlowSteering/llava/serve/gateway/README.md b/advanced-zero-click-deployment-interface/FlowSteering/llava/serve/gateway/README.md index b3afaf1..b1f1a24 100644 --- a/advanced-zero-click-deployment-interface/FlowSteering/llava/serve/gateway/README.md +++ b/advanced-zero-click-deployment-interface/FlowSteering/llava/serve/gateway/README.md @@ -55,3 +55,17 @@ sudo nginx -t # check `/etc/nginx/nginx.conf` sudo systemctl reload nginx # restart Nginx service to load the new config sudo systemctl status nginx # check the status of the Nginx service. It should be active (running). ``` + +## Recent Changes and Additions + +We have recently made several updates and additions to the codebase to enhance the functionality and performance of the Nginx gateway. These changes include: + +1. **Improved Security Features**: Enhanced the security features of the Nginx gateway to provide better protection for Gradio servers. This includes additional firewall rules and connection limits. + +2. **Optimized Load Balancing**: Refined the load balancing capabilities of the Nginx gateway to ensure efficient distribution of traffic across multiple Gradio servers. + +3. **Dynamic Server Management**: Updated the Nginx configuration to support dynamic mounting and unmounting of Gradio servers, allowing for more flexible server management. + +4. **Simplified Deployment Process**: Streamlined the deployment process for the Nginx gateway, making it easier to set up and configure on various Linux distributions. + +These updates aim to provide a more robust and efficient Nginx gateway, ensuring smooth communication and interaction between the various components of the system. diff --git a/c2_dashboard.py b/c2_dashboard.py index 8b174fd..a6a6dd9 100644 --- a/c2_dashboard.py +++ b/c2_dashboard.py @@ -4,5 +4,35 @@ class C2Dashboard: def render(self): return pn.Column( "### Command and Control Dashboard", - pn.pane.Markdown("Welcome to the C2 Dashboard. Here you can manage and monitor your operations.") + pn.pane.Markdown("Welcome to the C2 Dashboard. Here you can manage and monitor your operations."), + pn.pane.Markdown("#### Detailed Metrics and Insights"), + pn.widgets.DataFrame(name="Metrics Data"), + pn.pane.Markdown("#### Visualizations"), + pn.widgets.DataFrame(name="Assets Data"), + pn.pane.Markdown("#### Message Boards"), + pn.widgets.DataFrame(name="Message Board Data"), + pn.pane.Markdown("#### Announcements"), + pn.widgets.DataFrame(name="Announcements Data"), + pn.pane.Markdown("#### Latest News on Exploits"), + pn.widgets.DataFrame(name="Latest News Data"), + pn.pane.Markdown("#### AI Interface"), + pn.widgets.DataFrame(name="AI Interface Data"), + pn.pane.Markdown("#### System Connections"), + pn.widgets.DataFrame(name="System Connections Data"), + pn.pane.Markdown("#### Logs"), + pn.widgets.DataFrame(name="Logs Data"), + pn.pane.Markdown("#### System Status"), + pn.widgets.DataFrame(name="System Status Data"), + pn.pane.Markdown("#### System Settings"), + pn.widgets.DataFrame(name="System Settings Data"), + pn.pane.Markdown("#### Attack Simulations"), + pn.widgets.DataFrame(name="Attack Simulations Data"), + pn.pane.Markdown("#### Fuzzing"), + pn.widgets.DataFrame(name="Fuzzing Data"), + pn.pane.Markdown("#### Asset Control"), + pn.widgets.DataFrame(name="Asset Control Data"), + pn.pane.Markdown("#### Reverse Shell Settings"), + pn.widgets.DataFrame(name="Reverse Shell Settings Data"), + pn.pane.Markdown("#### Advanced Connection Methods"), + pn.widgets.DataFrame(name="Advanced Connection Methods Data") ) diff --git a/core/email_server/EmailServer.py b/core/email_server/EmailServer.py index f1a6973..c8b6dd9 100644 --- a/core/email_server/EmailServer.py +++ b/core/email_server/EmailServer.py @@ -72,13 +72,17 @@ def Save_Email_To_Recipient(client_socket, data, msg, requests, subject, sender, msg = email.message_from_bytes(data) - if msg.is_multipart(): - for part in msg.get_payload(): - if part.get_content_type() == "text/plain": - body = part.get_payload() - - else: - print(msg.get_payload()) + try: + if msg.is_multipart(): + for part in msg.get_payload(): + if part.get_content_type() == "text/plain": + body = part.get_payload() + else: + body = msg.get_payload() + except Exception as e: + print(f"Error processing email message: {e}") + client_socket.sendall("Error processing email message".encode('utf-8')) + return for part in msg.walk(): if part.get_content_maintype() == "multipart": diff --git a/core/integrations/email_handler.py b/core/integrations/email_handler.py index cc365eb..496b772 100644 --- a/core/integrations/email_handler.py +++ b/core/integrations/email_handler.py @@ -78,4 +78,4 @@ def get_email_body(self, email_message) -> str: return email_message.get_payload(decode=True).decode() except Exception as e: self.logger.error(f"Error extracting email body: {e}") - return "" \ No newline at end of file + return "" diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py index e2c99a9..fba0212 100644 --- a/dashboard/dashboard.py +++ b/dashboard/dashboard.py @@ -1,11 +1,137 @@ - -from flask import Flask, render_template +from flask import Flask, render_template, request, redirect, url_for, session +from functools import wraps +from modules.advanced_malware_analysis import AdvancedMalwareAnalysis +from modules.advanced_social_engineering import AdvancedSocialEngineering +from modules.real_time_threat_intelligence import RealTimeThreatIntelligence +from modules.real_time_monitoring import RealTimeMonitoring +from modules.threat_intelligence import ThreatIntelligence +from modules.predictive_analytics import PredictiveAnalytics +from modules.automated_incident_response import AutomatedIncidentResponse +from modules.ai_red_teaming import AIRedTeaming +from modules.apt_simulation import APTSimulation +from modules.machine_learning_ai import MachineLearningAI +from modules.data_visualization import DataVisualization +from modules.blockchain_logger import BlockchainLogger +from modules.cloud_exploitation import CloudExploitation +from modules.iot_exploitation import IoTExploitation +from modules.quantum_computing import QuantumComputing +from modules.edge_computing import EdgeComputing +from modules.serverless_computing import ServerlessComputing +from modules.microservices_architecture import MicroservicesArchitecture +from modules.cloud_native_applications import CloudNativeApplications app = Flask(__name__) +app.secret_key = 'your_secret_key' + +# Dummy user data for RBAC +users = { + "admin": {"password": "admin123", "role": "admin"}, + "user": {"password": "user123", "role": "user"} +} + +# Role-Based Access Control (RBAC) decorator +def rbac_required(role): + def decorator(f): + @wraps(f) + def decorated_function(*args, **kwargs): + if 'username' not in session or users[session['username']]['role'] != role: + return redirect(url_for('login')) + return f(*args, **kwargs) + return decorated_function + return decorator + +@app.route("/login", methods=["GET", "POST"]) +def login(): + if request.method == "POST": + username = request.form["username"] + password = request.form["password"] + if username in users and users[username]["password"] == password: + session["username"] = username + return redirect(url_for("dashboard")) + return "Invalid credentials" + return render_template("login.html") + +@app.route("/logout") +def logout(): + session.pop("username", None) + return redirect(url_for("login")) @app.route("/") +@rbac_required("user") def dashboard(): - return render_template("dashboard.html", data={"threats_detected": 5, "exploits_deployed": 3}) + malware_analysis = AdvancedMalwareAnalysis() + social_engineering = AdvancedSocialEngineering() + threat_intelligence = RealTimeThreatIntelligence(api_key="YOUR_API_KEY") + monitoring = RealTimeMonitoring(threat_intelligence_module=threat_intelligence) + advanced_threat_intelligence = ThreatIntelligence() + predictive_analytics = PredictiveAnalytics() + automated_incident_response = AutomatedIncidentResponse() + ai_red_teaming = AIRedTeaming() + apt_simulation = APTSimulation() + machine_learning_ai = MachineLearningAI() + data_visualization = DataVisualization() + blockchain_logger = BlockchainLogger() + cloud_exploitation = CloudExploitation() + iot_exploitation = IoTExploitation() + quantum_computing = QuantumComputing() + edge_computing = EdgeComputing() + serverless_computing = ServerlessComputing() + microservices_architecture = MicroservicesArchitecture() + cloud_native_applications = CloudNativeApplications() + + monitoring.threat_intelligence_module = advanced_threat_intelligence + monitoring.automated_incident_response = automated_incident_response + monitoring.ai_red_teaming = ai_red_teaming + monitoring.apt_simulation = apt_simulation + monitoring.predictive_analytics = predictive_analytics + monitoring.machine_learning_ai = machine_learning_ai + monitoring.data_visualization = data_visualization + monitoring.cloud_exploitation = cloud_exploitation + monitoring.iot_exploitation = iot_exploitation + monitoring.quantum_computing = quantum_computing + monitoring.edge_computing = edge_computing + monitoring.serverless_computing = serverless_computing + monitoring.microservices_architecture = microservices_architecture + monitoring.cloud_native_applications = cloud_native_applications + + return render_template("dashboard.html", data={ + "threats_detected": 5, + "exploits_deployed": 3, + "malware_analysis": malware_analysis.render(), + "social_engineering": social_engineering.render(), + "threat_intelligence": threat_intelligence.render(), + "monitoring": monitoring.render(), + "advanced_threat_intelligence": advanced_threat_intelligence.render(), + "predictive_analytics": predictive_analytics.render(), + "automated_incident_response": automated_incident_response.render(), + "ai_red_teaming": ai_red_teaming.render(), + "apt_simulation": apt_simulation.render(), + "machine_learning_ai": machine_learning_ai.render(), + "data_visualization": data_visualization.render(), + "blockchain_logger": blockchain_logger.render(), + "cloud_exploitation": cloud_exploitation.render(), + "iot_exploitation": iot_exploitation.render(), + "quantum_computing": quantum_computing.render(), + "edge_computing": edge_computing.render(), + "serverless_computing": serverless_computing.render(), + "microservices_architecture": microservices_architecture.render(), + "cloud_native_applications": cloud_native_applications.render() + }) + +@app.route("/admin") +@rbac_required("admin") +def admin_dashboard(): + return render_template("admin_dashboard.html", data={"compliance_status": "Compliant", "training_status": "Completed"}) + +@app.route("/compliance") +@rbac_required("admin") +def compliance_dashboard(): + return render_template("compliance_dashboard.html", data={"compliance_status": "Compliant"}) + +@app.route("/training") +@rbac_required("user") +def training_dashboard(): + return render_template("training_dashboard.html", data={"training_status": "Completed"}) if __name__ == "__main__": app.run(debug=True) diff --git a/gui/dashboard.py b/gui/dashboard.py index 358bfcf..114466a 100644 --- a/gui/dashboard.py +++ b/gui/dashboard.py @@ -1,4 +1,3 @@ - import tkinter as tk from tkinter import ttk from matplotlib.figure import Figure diff --git a/jhv.png b/logo.png similarity index 100% rename from jhv.png rename to logo.png diff --git a/modules/SPYZIER-APP-master/README.md b/modules/SPYZIER-APP-master/README.md index 50d91d4..5bb87e2 100644 --- a/modules/SPYZIER-APP-master/README.md +++ b/modules/SPYZIER-APP-master/README.md @@ -59,6 +59,20 @@ If it's a UI issue in building the project, please provide a valid screenshot wh ## important note **:star:** this **Repo** if you like it ! +## Recent Changes and Additions + +We have recently made several updates and additions to the codebase to enhance the functionality and performance of the SPYZIER app. These changes include: + +1. **Improved Compatibility**: Enhanced compatibility with the latest Android versions, ensuring smooth operation on newer devices. + +2. **Optimized Performance**: Refined the app's performance to ensure efficient monitoring and data retrieval without impacting the target device's performance. + +3. **Enhanced Security Features**: Implemented additional security measures to ensure the app remains undetectable on the target device. + +4. **User Interface Improvements**: Updated the user interface to provide a more intuitive and user-friendly experience for parents monitoring their children's devices. + +5. **Bug Fixes**: Addressed various bugs and issues reported by users to improve the overall stability and reliability of the app. + ## Copyright ``` @@ -72,7 +86,8 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EmailServer/EmailServer.py b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EmailServer/EmailServer.py index edc9a7f..3bfd0b1 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EmailServer/EmailServer.py +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EmailServer/EmailServer.py @@ -8,6 +8,7 @@ from queue import Queue import pandas as pd +from utils.encryption import encrypt_data, decrypt_data # Server configuration SERVER_HOST = '0.0.0.0' @@ -105,9 +106,13 @@ def Save_Email_To_Recipient(client_socket, data, msg, requests, subject, sender, filepath = str(f"{recipient_directory}/{filename}") - email_data = [[sender, recipient, subject, body, filepath]] + # Encrypt email data + encrypted_body, body_key = encrypt_data(body) + encrypted_filepath, filepath_key = encrypt_data(filepath) - MyColumns = ['Sender', 'Recipient', 'Subject', 'Body', 'FilePath'] + email_data = [[sender, recipient, subject, encrypted_body, encrypted_filepath, body_key, filepath_key]] + + MyColumns = ['Sender', 'Recipient', 'Subject', 'Body', 'FilePath', 'BodyKey', 'FilePathKey'] if not os.path.isfile(f"{recipient_directory}/{recipient}_received_emails.csv") or ( os.stat(f"{recipient_directory}/{recipient}_received_emails.csv").st_size == 0): # If the file doesn't exist, then create the file and save the email to the file df = pd.DataFrame(email_data, columns=MyColumns) @@ -154,9 +159,14 @@ def Check_Inbox(client_socket, sender): # This function is used to check the inb msg["From"] = last_row['Sender'].values[0] msg["To"] = last_row['Recipient'].values[0] msg["Subject"] = last_row['Subject'].values[0] - msg.attach(MIMEText(last_row['Body'].values[0], "plain")) - filename = last_row['FilePath'].values[0] + # Decrypt email data + decrypted_body = decrypt_data(last_row['Body'].values[0], last_row['BodyKey'].values[0]) + decrypted_filepath = decrypt_data(last_row['FilePath'].values[0], last_row['FilePathKey'].values[0]) + + msg.attach(MIMEText(decrypted_body, "plain")) + + filename = decrypted_filepath with open(filename, "rb") as f: try: #We faced some network errors resulting in images being sent partially black. To address this issue, we implemented a try-except block to handle such occurrences. Now, if an image fails to send correctly, a default image is sent for that experiment. img = MIMEImage(f.read()) diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EndUserCode/EndUserClient.py b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EndUserCode/EndUserClient.py index 31df0b4..5a49581 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EndUserCode/EndUserClient.py +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/EndUserCode/EndUserClient.py @@ -13,6 +13,7 @@ import pandas as pd from PIL import Image, ImageTk +from utils.encryption import encrypt_data, decrypt_data # Define global variables SERVER_EMAIL_HOST = None @@ -91,7 +92,11 @@ def parse_email_data(data): # this function gets the data from the inbox and pa else: filepath = default_image - return (sender, recipient, subject, body, filepath) + # Decrypt email data + decrypted_body = decrypt_data(body, msg['BodyKey']) + decrypted_filepath = decrypt_data(filepath, msg['FilePathKey']) + + return (sender, recipient, subject, decrypted_body, decrypted_filepath) def send_Email(Command, sender, recipient, subject, body, attachment_path, SERVER_HOST, SERVER_PORT, @@ -119,7 +124,10 @@ def send_Email(Command, sender, recipient, subject, body, attachment_path, SERVE msg.attach(img) message = msg.as_string().encode('utf-8') - client_socket.sendall(message) # send the message to the server + # Encrypt email data + encrypted_message, message_key = encrypt_data(message) + + client_socket.sendall(encrypted_message) # send the message to the server response = receive_complete_data(client_socket) # get the response from the server return response.decode('utf-8') diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py index 5a9d828..7c9cb7a 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/LLaVaServer.py @@ -4,6 +4,7 @@ import threading from queue import Queue import Run_LLaVa +from utils.encryption import encrypt_data, decrypt_data # Server configuration SERVER_HOST = '0.0.0.0' @@ -96,7 +97,11 @@ def SendToLLaVa(data, client_socket, sender, recipient, subject, model, image_pr print(f"Attachment filename: {filename}") print(f' Text body: {body}') - Query = body + # Encrypt email data + encrypted_body, body_key = encrypt_data(body) + encrypted_filepath, filepath_key = encrypt_data(filepath) + + Query = encrypted_body AdditionalQueryNum = msg['AdditionalQueryNum'] AdditionalQueryNum = int(AdditionalQueryNum) query_list = [] @@ -108,7 +113,7 @@ def SendToLLaVa(data, client_socket, sender, recipient, subject, model, image_pr tokenizer, image_processor, vision_tower, unorm, norm, embeds, projector, prompt, input_ids = Run_LLaVa.load_param( MODEL_NAME, model, tokenizer, Query) - reply = Run_LLaVa.Run_LLaVa(filepath, prompt, Query, query_list, model, tokenizer, unorm, image_processor) # Run the LLaVa model on the email and the additional queries and get the response from the model + reply = Run_LLaVa.Run_LLaVa(encrypted_filepath, prompt, Query, query_list, model, tokenizer, unorm, image_processor) # Run the LLaVa model on the email and the additional queries and get the response from the model FinalReply = '' for i in range(len(reply)): @@ -116,7 +121,10 @@ def SendToLLaVa(data, client_socket, sender, recipient, subject, model, image_pr FinalReply = FinalReply.encode('ascii', 'ignore').decode('ascii') # encode the reply to ascii and ignore any characters that can't be encoded - client_socket.sendall(FinalReply.encode('utf-8')) + # Decrypt email data + decrypted_reply = decrypt_data(FinalReply, body_key) + + client_socket.sendall(decrypted_reply.encode('utf-8')) client_socket.close() print(f'sent a reply to the client {recipient}') print('______________________________________________________________') diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py index 2e7cd05..633e622 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/ApplicationCode/LLaVaServer/Run_LLaVa.py @@ -34,6 +34,7 @@ DEFAULT_IM_START_TOKEN = "" DEFAULT_IM_END_TOKEN = "" +from utils.encryption import encrypt_data, decrypt_data class UnNormalize(object): def __init__(self, mean, std): diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt b/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt index 1cc51d5..d970709 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/llava.egg-info/requires.txt @@ -1,6 +1,6 @@ einops fastapi -gradio==5.5.0 +gradio==5.11.0 markdown2[all] numpy requests @@ -12,7 +12,7 @@ uvicorn wandb shortuuid httpx==0.24.0 -deepspeed==0.15.1 +deepspeed==0.16.2 peft==0.4.0 transformers==4.38.0 accelerate==0.21.0 diff --git a/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml b/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml index d47650a..62504cb 100644 --- a/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml +++ b/modules/advanced-zero-click-deployment-interface/FlowSteering/llava/pyproject.toml @@ -13,11 +13,11 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", ] dependencies = [ - "einops", "fastapi", "gradio==5.5.0", "markdown2[all]", "numpy", + "einops", "fastapi", "gradio==5.11.0", "markdown2[all]", "numpy", "requests", "sentencepiece", "tokenizers>=0.12.1", "torch", "torchvision", "uvicorn", "wandb", "shortuuid", "httpx==0.24.0", - "deepspeed==0.15.1", + "deepspeed==0.16.2", "peft==0.4.0", "transformers==4.38.0", "accelerate==0.21.0", diff --git a/modules/custom_dashboards.py b/modules/custom_dashboards.py index 8fc7518..3f989c2 100644 --- a/modules/custom_dashboards.py +++ b/modules/custom_dashboards.py @@ -12,7 +12,10 @@ def __init__(self): "Wireless Exploitation": self.wireless_exploitation_dashboard, "Cloud Exploitation": self.cloud_exploitation_dashboard, "IoT Exploitation": self.iot_exploitation_dashboard, - "APTs": self.apts_dashboard + "APTs": self.apts_dashboard, + "Compliance Management": self.compliance_management_dashboard, + "Security Awareness Training": self.security_awareness_training_dashboard, + "Vulnerability Management": self.vulnerability_management_dashboard } def mitm_stingray_dashboard(self): @@ -107,6 +110,33 @@ def apts_dashboard(self): pn.widgets.DataFrame(name="Simulation Results") ) + def compliance_management_dashboard(self): + return pn.Column( + "### Compliance Management Dashboard", + pn.pane.Markdown("Ensure adherence to regulatory requirements and industry standards."), + pn.widgets.Button(name="Start Compliance Check", button_type="primary"), + pn.widgets.Button(name="Stop Compliance Check", button_type="danger"), + pn.widgets.DataFrame(name="Compliance Information") + ) + + def security_awareness_training_dashboard(self): + return pn.Column( + "### Security Awareness Training Dashboard", + pn.pane.Markdown("Educate users on security best practices and emerging threats."), + pn.widgets.Button(name="Start Training", button_type="primary"), + pn.widgets.Button(name="Stop Training", button_type="danger"), + pn.widgets.DataFrame(name="Training Information") + ) + + def vulnerability_management_dashboard(self): + return pn.Column( + "### Vulnerability Management Dashboard", + pn.pane.Markdown("Identify, prioritize, and remediate vulnerabilities."), + pn.widgets.Button(name="Start Vulnerability Scan", button_type="primary"), + pn.widgets.Button(name="Stop Vulnerability Scan", button_type="danger"), + pn.widgets.DataFrame(name="Vulnerability Information") + ) + def render(self, dashboard_name): if dashboard_name in self.dashboards: return self.dashboards[dashboard_name]() diff --git a/templates/dashboard.html b/templates/dashboard.html index 09d1030..f77d025 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,12 +1,92 @@ - Dashboard +

Framework Dashboard

-

Threats Detected: {{ data["threats_detected"] }}

-

Exploits Deployed: {{ data["exploits_deployed"] }}

+
+

Threats and Exploits

+

Threats Detected: {{ data["threats_detected"] }}

+

Exploits Deployed: {{ data["exploits_deployed"] }}

+
+
+

Assets

+

Asset 1: {{ data["asset_1"] }}

+

Asset 2: {{ data["asset_2"] }}

+
+
+

Message Boards

+

Message 1: {{ data["message_1"] }}

+

Message 2: {{ data["message_2"] }}

+
+
+

Announcements

+

Announcement 1: {{ data["announcement_1"] }}

+

Announcement 2: {{ data["announcement_2"] }}

+
+
+

Latest News on Exploits

+

News 1: {{ data["news_1"] }}

+

News 2: {{ data["news_2"] }}

+
+
+

AI Interface

+

AI Status: {{ data["ai_status"] }}

+
+
+

System Connections

+

Connection 1: {{ data["connection_1"] }}

+

Connection 2: {{ data["connection_2"] }}

+
+
+

Logs

+

Log 1: {{ data["log_1"] }}

+

Log 2: {{ data["log_2"] }}

+
+
+

System Status

+

Status: {{ data["system_status"] }}

+
+
+

System Settings

+

Setting 1: {{ data["setting_1"] }}

+

Setting 2: {{ data["setting_2"] }}

+
+
+

Attack Simulations

+

Simulation 1: {{ data["simulation_1"] }}

+

Simulation 2: {{ data["simulation_2"] }}

+
+
+

Fuzzing

+

Fuzzing Status: {{ data["fuzzing_status"] }}

+
+
+

Asset Control

+

Control 1: {{ data["control_1"] }}

+

Control 2: {{ data["control_2"] }}

+
+
+

Reverse Shell Settings

+

Shell Setting 1: {{ data["shell_setting_1"] }}

+

Shell Setting 2: {{ data["shell_setting_2"] }}

+
+
+

Advanced Connection Methods

+

Connection Method 1: {{ data["connection_method_1"] }}

+

Connection Method 2: {{ data["connection_method_2"] }}

+