Skip to content

Development

Michael Messner edited this page Sep 9, 2021 · 11 revisions

Structure of EMBA

.
├── config/
├── documentation/
├── helpers/
├── modules/
├── scan-profiles/
├── Dockerfile
├── README.md
├── check_project.sh
├── docker-compose.yml
├── Dockerfile
├── emba.sh
└── installer.sh

config/

Configuration files for different modules with file names, regular expressions or paths. These files are very handy, easy to use and they also keep the modules clean.

helpers/

Some scripts with basic functions for EMBA, e.g. colored and uniform output on the console or the creation of log files. All modules can access these functions. These are listed and explained in the template file.

modules/

All EMBA features are available as separate modules.

scan-profiles/

A selection of EMBA scan profiles. Learn here how to use them.

emba.sh

Main script of EMBA: Usage.

check_project.sh

Script to run ShellCheck over all shell scripts of EMBA.

installer.sh

Install all dependencies of EMBA: Installation.

Dockerfile and docker-compose.yml

EMBA is able to run itself in a Docker container: Docker usage.


Development of modules

To make the development of new modules as easy as possible, we have packed a template file into the repository, which contains all possible function calls for EMBA. This file is provided with comments.

Mandatory content of a module if it had the file name S42_example_module():

S42_example_module() {
  # Initializes module and creates a log file "S42_example_module.txt" in your log folder
  module_log_init "${FUNCNAME [0]}"
  # Prints title to CLI and into log
  module_title "Example module"

  [...]

  # Ends module and saves status into log - $COUNT_FINDINGS has to be replaced by a number of your findings. 
  # If your module didn't found something, then it isn't needed to be generated in the final report
  module_end_log "${FUNCNAME[0]}" "${#COUNT_FINDINGS[@]}"
}

The function that calls module_log_init(), module_title() and module_end_log() are required.

If you just want to test something and don't want to write a completely new module: Just add your command to X150_user_checks.sh and change the leading X to an S.