How sunweb3sec/defihacklabs works
Main Components
• Educational (Academy) Module:
– Directory: “academy”
– Contains lessons and tutorials under multiple sections (e.g., “move”, “onchain_debug”, “solidity”, “user_awareness”)
– Supports multiple languages (en, es, ko, vi, etc.) for each lesson.
– These lessons function as a self-contained Web3 cybersecurity academy.
• Exploit Simulation/Test Module:
– Directory: “src/test” (organized under date-based folders) where Foundry test contracts simulate actual DeFi attack scenarios.
– The “script” directory can also be seen as supporting automation or auxiliary deployment tasks.
• Historical Data Archive:
– Directory: “past” (with subdirectories per year) that compiles previous hacks or cleanup case studies in README files.
• Dependency and Library Management:
– Directory: “lib” (includes forge-std and possibly other libraries)
– Contains configuration artifacts like “foundry.toml”, “remappings.txt”, and formatter config “.prettierrc”
• CI/CD and Project Management:
– .github folder: Contains workflows (e.g., PRAutoTest.yml) and issue templates that integrate with automated testing and development guidelines.
– CONTRIBUTING.md and .gitmodules also contribute to project governance and submodule management.
Relationships and Interactions
• Foundry Testing Framework:
– Central to the project, it orchestrates the execution of smart contract tests (located in “src/test”) against vulnerabilities.
• Educational Content Integration:
– The “academy” provides contextual background on hacking techniques and security practices; it is logically separate but related to the test module.
– Indicate how lessons reference specific exploits that are demonstrated in the “src/test” section and sometimes in the “past” archive.
• Historical Archive:
– The “past” directory aggregates background case studies and serves as a knowledge base.
– Show connections from the “Academy” and “Exploit Module” to “Historical Archive” to indicate that the simulated exploits are based on actual incidents.
• Continuous Integration (CI) & Version Control:
– Illustrate the role of the .github workflows in triggering tests and reporting gas usage, ensuring quality and automation.
– Integrate “CONTRIBUTING.md” and other project governance files as external influences on development practices.
Architectural Patterns and Technologies
• Modular Design:
– Separate the project into clearly defined modules (educational, test harness, archive), each represented by its own block.
• Multi-language & Multi-format Support:
• Testing and Gas Reporting:
– Illustrate the integration of Foundry’s test command (including gas reports) which is central for simulating exploits.