# IoT PreTester V4.5 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE) ## Overview The **IoT PreTester V3** project is an integrated platform for analyzing and evaluating IoT devices, firmware files, and network traffic. It combines a **Django backend** for data storage, API, and analysis with a **Next.js frontend** for user management, device administration, and result visualization. The solution allows administrators to manage manufacturers, device types, and users, analyze firmware uploads (Binwalk, Strings, Hashes, PCAP), and view results via a modern web interface. --- ## Main Components ### Backend – Django **Path:** `django_project/` **Framework:** Django + Django REST Framework Structure and main modules: - **IoTAnalyzer/** – Core application containing models, views, URLs, and analysis functions - `models.py` – Data model (devices, firmware, manufacturers, analysis results) - `views.py` – REST APIs for device management, file uploads, authentication - `urls.py` – API routing and endpoint definition - `db_create.py`, `db_read.py`, `db_update.py`, `db_delete.py` – CRUD logic - `analyze/` – Modules for firmware, PCAP, URL, and hash analysis - `management/commands/` – Management commands for automated analysis - **IoTPreTester/** – Django project configuration (settings, middleware, routing) - **templates/** – Classic Django template (e.g., index page) - **static/** – Static assets for legacy UI components - **tests/** – Unit and integration tests --- ### Frontend – Next.js **Path:** `Frontend/iot-pre-tester-frontend/` **Framework:** Next.js + TypeScript + Tailwind CSS + shadcn/ui Structure and main modules: - **`src/app/`** – App routes in Next.js App Router style - `login/`, `change-password/` – Authentication - `devices/` – Device management and details view - `manage-users/`, `manage-device-types/`, `manage-manufacturers/` – Admin features - `scan-results/`, `analysis/` – Display of analysis results - **`src/components/`** – UI components, upload modules, authentication, providers - **`src/lib/`** – API hooks, contexts, utility functions - **`src/services/`** – HTTP services and file upload handlers - **`src/types/`** – TypeScript type definitions - **`public/`** – Static assets, images, and upload directories - **Configuration files:** `next.config.ts`, `tailwind.config.ts`, `tsconfig.json` --- ### Analysis and Data Processing **Path:** `django_project/IoTAnalyzer/analyze/` Included modules: - `analyze_pcap.py` – Evaluation of PCAP files (e.g., hashes, URLs) - `analyze_firmware.py` – Extraction of strings and binary data from firmware - `analyze_hashes.py` – Hash analysis (including password cracking via rockyou.txt) - `analyze_url.py`, `analyze_dns.py` – DNS/URL validation and network checks Results are persisted in the _RawData_, _AnalyzedData_, _Firmware_, _Device_, and related models. --- ## Docker Commands ### Starting the Containers ```bash # 1. Change to this directory cd V4.5 # 2. Configure environment variables (only the first time) cp .env.example .env nano .env # Adjust: SECRET_KEY, DJANGO_SUPERUSER_PASSWORD, etc. # 3. Build and start the containers docker compose up -d --build # 4. Wait until both containers report "healthy" docker compose ps ``` The first start takes a few minutes (images are built, the database is created and seeded with default manufacturers/device types). The frontend only starts once the backend healthcheck passes. After the first successful start, set `INIT_DATABASE=false` in `.env` to skip re-seeding on later starts. Then log in at http://localhost:3000 with the superuser from `.env` (default username `admin`, password = `DJANGO_SUPERUSER_PASSWORD`). Demo files for trying out the analysis are in [`demo_files/`](./demo_files/). A full German step-by-step guide (start, usage, shutdown) is in the [repository README](../README.md). ## Stopping the Containers ```bash # Stop containers (data is preserved) docker compose stop # OR: Stop and remove containers (data is preserved) docker compose down # OR: Remove everything including volumes/data (caution!) docker compose down -v ``` ## Quick overview | Action | Command | | ------ | ------------------------ | | Start | `docker compose up -d` | | Stop | `docker compose stop` | | Status | `docker compose ps` | | Logs | `docker compose logs -f` | ## Access - **Frontend**: http://localhost:3000 - **Backend API**: http://localhost:8000 --- ## License This project is licensed under an internal research and development license. Commercial use or distribution requires written permission from the project owner.