- Final Project for 50.053 Software Testing SUTD written in Python.
- Two independent fuzz targets: BLE smart-lock firmware and a Django web application.
- Goal: detect crashes, undefined behaviour and maximise branch coverage.
- Engine: American Fuzzy Lop (AFL) based for genetic mutations & lightweight instrumentation.
flowchart TD
subgraph Setup Django Environment
AA[install_django.sh] --> AB[Create venv, install deps, pre-warm server]
end
subgraph Bootstrap Environment
A[run.sh] --> B[Create/activate global venv & install deps]
end
AB --> A
B --> C[Executes main.py]
subgraph Interactive CLI
C --> D["print_commands()"]
D --> E["get_args_interactive()"]
E --> F{User command}
F -->|DJANGO| G["ensure_django_app_available()"]
G --> H{File path provided?}
H -->|Yes| I["fuzz_main(filepath) – targeted Django fuzz"]
H -->|No| J["fuzz_main() – general Django fuzz"]
F -->|BLE| K["ensure_ble_app_available()"]
K --> L{--resume filepath?}
L -->|Yes| M["ble_main(filepath) – resume session"]
L -->|No| N["ble_main() – fresh BLE fuzz"]
end
-
run.sh / run.bat
– repository bootstrapper- Change to the project root –
cd "$(dirname "$0")"
guarantees the script always runs from its own folder. - Create / activate a local virtual-env – If the hidden folder
.local/
doesn’t exist, the script creates it (python3 -m venv .local
) and then activates it. - Install or update Python requirements – If a
requirements.txt
file is present in the root, it upgradespip
and installs the pinned packages into the virtual-env. - Delegate to
main.py
– Finally itexec
spython main.py
, handing control (and the already-active environment) to your interactive fuzzer CLI.
- Change to the project root –
-
install_django.sh / install_django.bat
— Django target bootstrap- Locates
DjangoWebApplication/
and switches into it. - Creates & activates a dedicated virtual-env (
virtual/
) if missing. - Installs/updates all Python requirements.
- Pre-warms the project by launching Django for a few seconds, compiling byte-code and loading migrations so subsequent starts are instant.
- Locates
After the script finishes, the virtual environment remains active and the Django server can be started immediately by the fuzzer or any other tool.
main.py
– interactive AFL front-end- Loads
.env
configuration. - Sets up colourised logging.
- Prompts for a fuzzing command.
- Validates arguments and dispatches to the correct harness.
- Loads
Prerequisites: Python ≥ 3.10, AFL++, GNU make (Linux/macOS) or WSL (Windows), BLE tool-chain, Django 4.x.
# clone & bootstrap
git clone https://github.com/mrmrjing/SoftwareTestingProject
cd SoftwareTestingProject
# one-time Django environment & pre-warm
./install_django.sh
# launch interactive CLI
./run.sh
Target | Fresh run | Resume / file-specific run |
---|---|---|
BLE | BLE |
BLE --resume <path-inside-BLE/> |
Django | DJANGO |
DJANGO <file-path> |
install_django.bat
run.bat
Target | Fresh run | Resume / file-specific run |
---|---|---|
BLE | BLE |
BLE --resume <path\inside\BLE\> |
Django | DJANGO |
DJANGO <file-path> |