-
Notifications
You must be signed in to change notification settings - Fork 3
merge branch #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
merge branch #49
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ab1581b
Bump the pip group across 2 directories with 2 updates
dependabot[bot] 81ac252
Add encryption to email data
ProjectZeroDays 99bee48
Add customizable dashboards to provide tailored security insights and…
ProjectZeroDays cef15f4
Add customizable dashboards to provide tailored security insights and…
ProjectZeroDays 452504f
Rename jhv.png to logo.png
ProjectZeroDays 3c66db7
Update the README.md files
ProjectZeroDays f518884
Update LICENSE
ProjectZeroDays 24c15ea
Update dashboard.py
ProjectZeroDays 56eb087
Update dashboard.py
ProjectZeroDays 014ac0b
Update dashboard.py
ProjectZeroDays 598d6bc
Fix errors and add implementation checklist
ProjectZeroDays b2f2638
Fix errors and add implementation checklist (#45)
ProjectZeroDays 69caf31
Revert "Fix errors and add implementation checklist"
ProjectZeroDays 3882fdb
Update README.md
ProjectZeroDays 2f96ea0
Merge branch 'Your-Momma-Beeotch' into revert-45-fix-errors
ProjectZeroDays 0417811
Revert "Fix errors and add implementation checklist" (#46)
ProjectZeroDays a731e9a
Fix all errors
ProjectZeroDays ba2e03b
Fix all errors (#47)
ProjectZeroDays cb003f4
Merge branch 'Your-Momma-Beeotch' into update-readme
ProjectZeroDays 344e43d
Update the README.md files (#43)
ProjectZeroDays 82383fb
Merge branch 'Your-Momma-Beeotch' into add-encryption
ProjectZeroDays 11aaa6d
Add encryption to email data (#40)
ProjectZeroDays 9992882
Merge branch 'Your-Momma-Beeotch' into dependabot/pip/advanced-zero-c…
ProjectZeroDays 099b3bc
Bump the pip group across 2 directories with 2 updates (#39)
ProjectZeroDays 47ea760
Fix all errors in the repository
ProjectZeroDays 0e00f6d
Fix all errors in the repository (#48)
ProjectZeroDays File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <https://unlicense.org> | ||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | | ||
| |---------------------------------------------|-----------------------------------------------------| | ||
| |  |  | | ||
|
|
@@ -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 [email protected] --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 [email protected] | ||
| ``` | ||
|
|
||
|
|
||
| ## 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. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Binding a socket to all network interfaces Medium
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to bind the server socket to a specific network interface instead of all interfaces. This can be done by replacing '0.0.0.0' with the IP address of the dedicated interface that the server should listen on.
SERVER_HOSTwith this specific IP address.