How nc3-lu/testingplatform works
Project type and purpose
– It’s a full-stack web application built on Django (see testing_platform/ settings.py, wsgi.py, asgi.py).
– Purpose: provide a suite of security and compliance testing tools (apps under testing/, automation/, iot_inspector/, onekey/, etc.), plus an API (api/ serializers.py, views.py), user authentication (authentication/), and documentation (docs/).
File structure
– Top-level “testing_platform” Django project containing settings, URL routing, ASGI/WSGI.
– Multiple Django “apps” each encapsulating a feature (authentication, testing, automation, c3_protocols, contact, iot_inspector, knowledge_base, landing_page, legal_section, onekey, specialized_testing, plus api/).
– Static assets under static_global/, project-wide base templates under templates/.
– A separate small “dmarc-collector” CLI/service under dmarc-collector/.
– Dockerfile, entrypoint.sh, Makefile for containerization and orchestration.
– CI/CD pipelines under .github/workflows/ and .gitlab-ci.yml.
– Celery tasks in automation/tasks.py (implying a message broker).
README for additional insights
– README confirms a “Testing Platform” with full documentation in docs/.
a. Main components
• Client/User Interface: Web browser (HTML/CSS/JS served by Django templates & static files)
• Web Server / Reverse Proxy: Nginx (or similar)
• Application Server: Gunicorn/Uvicorn hosting the Django project
• Django Monolith:
– Core project (testing_platform/) for settings, URL routing, middleware
– Feature apps (authentication/, testing/, automation/, iot_inspector/, onekey/, etc.)
– API layer (api/) implementing REST endpoints
• Background Worker: Celery (automation/tasks.py) + Message Broker (Redis/RabbitMQ)
• Datastore: PostgreSQL (or other RDBMS—implied by migrations/)
• External Services & Tools:
– ZAP scanner, WHOIS lookup, DMARC reports, other security scanners invoked via helpers.py in testing/ and automation/
– dmarc-collector service (stand-alone process under dmarc-collector/)
• Static & Media Storage: Local filesystem or S3 for static_global/ and uploaded files
• Documentation & CI/CD: ReadTheDocs (docs/), GitHub Actions / GitLab CI pipelines
b. Relationships & data flows
1. User → Browser → Nginx → Gunicorn → Django routing (testing_platform/urls.py)
2. Django handles HTTP requests: invokes views in feature apps
3. Views → Models → Database for reads/writes
4. Long-running tasks (e.g., automated WHOIS, ZAP) → Celery task queue → Worker → update DB → send notifications
5. API clients → Django Rest Framework endpoints (api/) → DB or background tasks
6. Documentation pipeline triggered via CI/CD to build & publish docs
c. Architectural patterns & design principles
– Monolithic modular architecture: each Django app encapsulates a distinct domain
– MVC/MVT pattern (Models, Views, Templates)
– Separation of concerns: web layer vs. background tasks (Celery)
– Configuration as code: Dockerfile, Makefile, CI workflows
– Extensibility: clear apps structure allows adding new features
d. Key technologies & libraries
– Python 3.x, Django, Django REST Framework (api/), Celery, Redis/RabbitMQ, PostgreSQL
– Docker & Docker Compose, Make, GitHub Actions/GitLab CI
– Frontend: Bootstrap (static_global/css), vanilla JS (chart.js, nav.js, etc.)
– Third-party scanners (OWASP ZAP), WHOIS libraries, DMARC utilities
Detail
– Don’t just lump everything as “Django.” Break out: web layer vs. API vs. background tasks vs. each major feature app (or at least group by category: “Testing Apps,” “Automation,” “Authentication,” etc.).
– Include CI/CD and docs as auxiliary components if desired, showing how code changes flow into builds, tests, and deployment.