mirror of
https://github.com/e-m-b-a/emba.git
synced 2026-10-11 22:09:54 +00:00
3.1 KiB
3.1 KiB
EMBA - Agent Guide
Overview
EMBA (Embedded Linux Analyzer) is a firmware security analysis and SBOM tool. It is written entirely in Bash and runs as sudo ./emba. All code must pass strict mode (-S flag) and ShellCheck.
Key Commands
| Action | Command |
|---|---|
| Install deps | sudo ./installer.sh -d |
| Default scan | sudo ./emba -l ~/log -f ~/firmware -p ./scan-profiles/default-scan.emba |
| SBOM scan | sudo ./emba -l ~/log -f ~/firmware -p ./scan-profiles/default-sbom.emba |
| Emulation scan | sudo ./emba -l ~/log -f ~/firmware -p ./scan-profiles/default-scan-emulation.emba |
| All scan profiles | ./scan-profiles/*.emba |
| GUI launcher | ./launcher (requires zenity) |
Verification (CI checks + unit tests)
# Unit tests (bats framework, ~140 tests across 11 suites)
./tests/run.sh
# ShellCheck + semgrep on all .sh files
./check_project.sh # with --fast for quicker runs
./check_project.sh --fast
# Format check (2-space indent, no tabs)
shfmt -d -i 2 .
# ShellCheck standalone
shellcheck -x -o require-variable-braces ./emba ./modules/*.sh ./helpers/*.sh
# Strict mode runtime test
sudo ./emba -S -l ~/log -f ~/firmware -p ./scan-profiles/quick-scan.emba
Architecture
./emba— main entrypoint (bash), sources helpers then loads modules./modules/— scan modules, ordered by prefix (alphanumeric sorting viasort -V):P*— extraction (binwalk, UEFI, ubifs, etc.)S*— static analysis (binary checks, kernel, passwords, etc.)L*— live/emulation checks (nmap, SNMP, web, metasploit)F*— final aggregation (SBOM, aggregator, tag builder)D*— firmware diffing
./helpers/— imported helper libraries (helpers_emba_*.sh)./installer/— per-component install scripts (I*,IF*,IL*,IP*)./config/— configuration (profile triggers, CVEs, blacklists, version identifiers)./scan-profiles/—.embaprofile files that enable/disable modules./external/— gitignored; prebuilt kernel images + tool binaries for emulation
Code Conventions
- Indent: 2 spaces, no tabs. Enforced by
shfmt. - Functions:
snake_case(). One blank line between functions. - Global vars:
CAPITALIZED_WITH_UNDERSCORES. - Local vars:
l-prefixedUPPER_SNAKE_CASE(e.g.,lMODULE_FILE). - Strict mode: All scripts must pass
wickStrictModeFail(loaded viainstaller/wickStrictModeFail.sh). - ShellCheck: Do not disable checks; fix the issue instead.
- Copyright header: GPLv3, Siemens Energy AG, on every new file.
Docker
Primary deployment method. Build - uses Dockerfile (Kali base):
BUILDKIT_NO_CLIENT_TOKEN=1 DOCKER_BUILDKIT=1 sudo -E docker compose --progress=plain build --no-cache --pull
Run: EMBA is automatically starting up the required docker images.
Mounts: FIRMWARE, LOG, EMBA env vars required. Container runs privileged.
Merging / PRs
- Base on
master. Usegit rebase -ito structure logical commits. - After each commit, EMBA must work (no temporary breakage).
- All CI must pass: ShellCheck, shfmt, semgrep,
check_project.sh. - Target OS: Kali Linux rolling / Ubuntu 22.04 LTS.