s4dhulabs / vimana-framework

Vimana is an experimental security framework that aims to provide resources for auditing Python web applications.
GNU General Public License v3.0
64 stars 9 forks source link

Automate Menu Help Updates #2

Open s4dhulabs opened 1 day ago

s4dhulabs commented 1 day ago

Description: As the framework grows and gains complexity, it has become challenging to keep the menus updated. For instance, if a new command is added, the instructions on how to use it may take time to be updated, resulting in outdated help menus compared to the framework's resources. Currently, this is done in a very rudimentary way, requiring manual editing of several files and modules to work as expected.

Technical Details: Implement a dynamic system to automatically update the help menus when new commands are added. Use a configuration file or a centralized registry to store command descriptions. Modify the vmnf_helpers.py file to read from this configuration file or registry. Ensure that the help menu is generated dynamically based on the current commands and their descriptions.

Proposed Solution: Command Metadata Annotations: Use decorators to annotate command functions with metadata, including descriptions. This metadata can be automatically extracted to update the help menus. Documentation Generation Tool: Integrate a documentation generation tool (e.g., Sphinx) to automatically generate and update help menus based on the codebase. Database Integration: Store command descriptions in a database and create an API to fetch and update these descriptions dynamically.

Example of Command Metadata Annotations:

commands_registry = {}

def command(description):
    def decorator(func):
        commands_registry[func.__name__] = description
        return func
    return decorator

@command("Run a resource, plugin or case")
def run():
    pass

@command("Start Vimana in an interactive mode")
def start():
    pass

Benefits:

Future Considerations:

s4dhulabs commented 1 day ago

Dynamic menu enhancements.