How mrrootsec/assetviz works
Main Components
• CLI/Entry Point: Represented by main.go, this is the starting point that handles command-line arguments (e.g., the “-f” flag or STDIN input).
• Input Handler: A module that processes input either via file (using the “-f” flag) or piped STDIN data.
• Parsing/Processing Engine: The logic that takes the subdomain lines, parses them, and builds an internal representation of the domain’s structure.
• Visualization/Report Generator: The component that converts the processed subdomain data into a mind map and then generates an HTML report in the output folder (.report). This might include formatting and layout algorithms.
• File/Output Manager: Responsible for writing the generated HTML report to the designated location with a timestamped filename.
• (Optionally) Configuration & Dependency Management: Indicated by Go modules files (go.mod and go.sum) which also outline external libraries that may be used.
Relationships and Interactions
• The CLI (main.go) receives the command-line arguments. It then calls the Input Handler.
• The Input Handler reads either the file specified by the “-f” flag or directly from STDIN.
• The raw data is passed to the Parsing/Processing Engine, which constructs a structured model representing the hierarchy of subdomains.
• The model is provided to the Visualization component, which transforms the data into a visual representation (a mind map).
• Finally, the Output Manager takes the visualization and saves it as an HTML file (placed in the .report folder) with an appropriate timestamp.
• Optionally, error handling, logging, and configuration components can be added as auxiliary parts.
Architectural Patterns and Technologies
• Modular design: Each step (input handling, processing, and visualization) is split into discrete, independent modules.
• Single Responsibility Principle: Each component (CLI, parser, visualizer, output manager) carries a unique responsibility.
• Technology: Go for the core application logic, with external packages managed via go.mod (they could be for HTML templating, file I/O, or CLI parsing).
Elements
• Also, include feedback loops if error handling returns information back to the CLI.
• User interface components (the CLI).
• Data processing components (Input Handler and Parsing Engine).
• Output components (Visualization and Report Generation).
• Annotations (like notes) to mention that modules like configuration or dependency management (go.mod) exist even if they are not directly part of the runtime flow.