diff --git a/README.md b/README.md index 12e74ab643..613ecfca9b 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,24 @@ Contact us in our [Discord Server](https://discord.gg/WJ9XF9czVT)! For more information on each function supported by Bruce, [read our wiki here](https://github.com/pr3y/Bruce/wiki). Also, [read our FAQ](https://github.com/pr3y/Bruce/wiki/FAQ) +## :file_folder: Documentation + +This repository is fully documented using Doxygen. To generate the documentation, run the following command: + +```sh +doxygen Doxyfile +``` + +The documentation will be generated in the `docs/` directory. + +The code is organized into the following directories: + +- `src/`: Contains the main source code. +- `src/core/`: Contains the core functionalities of the firmware. +- `src/modules/`: Contains the different modules of the firmware. +- `include/`: Contains the header files. +- `lib/`: Contains the external libraries. + ## :computer: List of Features
@@ -259,4 +277,3 @@ Other media can be [found here](./media/). ## :construction: Disclaimer Bruce is a tool for cyber offensive and red team operations, distributed under the terms of the Affero General Public License (AGPL). It is intended for legal and authorized security testing purposes only. Use of this software for any malicious or unauthorized activities is strictly prohibited. By downloading, installing, or using Bruce, you agree to comply with all applicable laws and regulations. This software is provided free of charge, and we do not accept payments for copies or modifications. The developers of Bruce assume no liability for any misuse of the software. Use at your own risk. - diff --git a/build.py b/build.py index 310c16027b..3fe070a156 100644 --- a/build.py +++ b/build.py @@ -1,3 +1,12 @@ +""" +This script is a SCons build script for PlatformIO projects. + +It provides the following functionalities: +- Merges the bootloader, partition table, and application binaries into a single firmware binary. +- Checks if the firmware size exceeds the OTA partition size. +- Provides a custom target to build the merged firmware. +- Provides a custom target to upload the firmware without rebuilding. +""" from pathlib import Path import csv from SCons.Script import Import diff --git a/include/MenuItemInterface.h b/include/MenuItemInterface.h index 6f365cb1ae..088b5d925f 100644 --- a/include/MenuItemInterface.h +++ b/include/MenuItemInterface.h @@ -4,16 +4,51 @@ #include "core/display.h" #include +/** + * @brief The MenuItemInterface class. + * + * This class is an interface for the menu items. + */ class MenuItemInterface { public: + /** + * @brief Destroy the Menu Item Interface object + * + */ virtual ~MenuItemInterface() = default; + /** + * @brief The options menu. + */ virtual void optionsMenu(void) = 0; + /** + * @brief Draws the icon. + * + * @param scale The scale of the icon. + */ virtual void drawIcon(float scale = 1) = 0; + /** + * @brief Draws the icon image. + */ virtual void drawIconImg() = 0; + /** + * @brief Gets the theme. + * + * @return bool True if the theme is enabled, false otherwise. + */ virtual bool getTheme() = 0; + /** + * @brief Gets the name. + * + * @return String The name. + */ String getName() const { return _name; } + /** + * @brief Draws the menu item. + * + * @param scale The scale of the menu item. + */ void draw(float scale = 1) { if (rotation != bruceConfig.rotation) resetCoordinates(); if (!getTheme()) { @@ -30,6 +65,11 @@ class MenuItemInterface { drawStatusBar(); } + /** + * @brief Draws the arrows. + * + * @param scale The scale of the arrows. + */ void drawArrows(float scale = 1) { tft.fillRect(arrowAreaX, iconAreaY, arrowAreaW, iconAreaH, bruceConfig.bgColor); tft.fillRect( @@ -83,6 +123,11 @@ class MenuItemInterface { ); } + /** + * @brief Draws the title. + * + * @param scale The scale of the title. + */ void drawTitle(float scale = 1) { int titleY = iconCenterY + iconAreaH / 2 + FG; @@ -112,12 +157,26 @@ class MenuItemInterface { int arrowAreaX = BORDER_PAD_X; int arrowAreaW = iconAreaX - arrowAreaX; + /** + * @brief Construct a new Menu Item Interface object + * + * @param name The name of the menu item. + */ MenuItemInterface(const String &name) : _name(name) {} + /** + * @brief Clears the icon area. + */ void clearIconArea(void) { tft.fillRect(iconAreaX, iconAreaY, iconAreaW, iconAreaH, bruceConfig.bgColor); } + /** + * @brief Clears the image area. + */ void clearImgArea(void) { tft.fillRect(7, 27, tftWidth - 14, tftHeight - 34, bruceConfig.bgColor); } + /** + * @brief Resets the coordinates. + */ void resetCoordinates(void) { // Recalculate Center and ared due to portrait/landscape changings if (tftWidth > tftHeight) { diff --git a/include/globals.h b/include/globals.h index fea74f4162..06b09b26c1 100644 --- a/include/globals.h +++ b/include/globals.h @@ -1,3 +1,7 @@ +/** + * @file globals.h + * @brief This file contains all the global variables and functions. + */ #ifndef __GLOBALS__ #define __GLOBALS__ @@ -93,6 +97,10 @@ extern bool BLEConnected; // inform if BLE is active or not extern bool gpsConnected; // inform if GPS is active or not +/** + * @struct Option + * @brief A struct to represent a menu option. + */ struct Option { String label; std::function operation; @@ -110,6 +118,10 @@ struct Option { : label(lbl), operation(op), selected(sel), hover(hov), hoverPointer(ptr), hovered(hvrd) {} }; +/** + * @struct keyStroke + * @brief A struct to represent a key stroke. + */ struct keyStroke { // DO NOT CHANGE IT!!!!! bool pressed = false; bool exit_key = false; @@ -141,6 +153,10 @@ struct keyStroke { // DO NOT CHANGE IT!!!!! } }; +/** + * @struct TouchPoint + * @brief A struct to represent a touch point. + */ struct TouchPoint { bool pressed = false; uint16_t x; @@ -158,6 +174,15 @@ extern TouchPoint touchPoint; extern keyStroke KeyStroke; extern std::vector