Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metasploit system emulation integration #357

Merged
merged 30 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Steps to reproduce the behavior:
1. EMBA installation (dev-mode/default mode)
2. Use the firmware available here: <Insert URL>
3. Start EMBA with the following parameters: sudo ./emba.sh <insert further parameters>
4.
4. additional steps
5. See error

**Expected behavior**
Expand All @@ -25,7 +25,9 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Kali Linux 2022.01]
- OS: e.g. Kali Linux 2022.03
- EMBA version: v1.1.2 or current master branch
- Installation method: default with up to date docker image

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
A clear and concise description of what the problem is. Ex. I'm always frustrated when ...

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ It also sketches the typical integration process of patches.
- check with your employer when not working on your own!

- test your code with shellcheck [**required**]
- see the included [shellchecker script](./check_project.sh)
- see the included [codechecker script](./check_project.sh)
- shellcheck should not be disabled on areas with issues -> solve these problems before the PR

- test your code in strict mode (EMBA parameter -S) [**required**]
- all code should be strict mode compatible

- send reminder if nothing happens after about a week

- the code needs to work on the latest Kali Linux (other distributions are welcome but currently not tested)
- feel free to mention [EMBA team members](https://github.com/orgs/e-m-b-a/people) in the issue/PR.

- the code needs to work on the latest Kali Linux and Ubuntu 22.04LTS (other distributions are welcome but currently not tested)

## 2) Code Guidelines

Expand Down
28 changes: 16 additions & 12 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@

The EMBA project is very thankful to the individuals who contributed to the project.

Want to contribute as well? Here are some suggestions:

- Create new module for a test currently not supported by EMBA
- Report or fix (unexpected) errors
- Share missing results and findings
- Share firmware where EMBA is not performing as expected
- Improve code quality
- Improve performance
- Check the current [issues](https://github.com/e-m-b-a/emba/issues) if some issue needs help

See [CONTRIBUTING.md](https://github.com/e-m-b-a/emba/blob/master/CONTRIBUTING.md) for more details.
Want to contribute as well? Here are some suggestions:

- Create new module for a test currently not supported by EMBA
- Report or fix (unexpected) errors
- Share missing results and findings
- Share firmware where EMBA is not performing as expected
- Improve code quality
- Improve performance
- Improve textblocks for [report templates](https://github.com/e-m-b-a/emba/tree/master/config/report_templates)
- Improve license and version detection [configuration](https://github.com/e-m-b-a/emba/blob/master/config/bin_version_strings.cfg)
- Review the [wiki](https://github.com/e-m-b-a/emba/wiki) for outdated information and open dedicated issues
- Check the current [issues](https://github.com/e-m-b-a/emba/issues) if some issue needs help.
- For interested first-time contributors we created the label [good first issue](https://github.com/e-m-b-a/emba/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)

See [CONTRIBUTING.md](https://github.com/e-m-b-a/emba/blob/master/CONTRIBUTING.md) for more details.

==========================================================================================

Expand All @@ -24,8 +28,8 @@ These people have contributed to EMBA:

* Michael Messner (original author)
* Pascal Eckmann (original author)
* [Arnold Unterauer](https://github.com/Anemosx)
* [Benedikt Kuehne](https://github.com/BenediktMKuehne)
* [Arnold Unterauer](https://github.com/Anemosx)
* [seanog8](https://github.com/seanog8)
* [Stefan Haboeck](https://github.com/StefanHaboeck)
* [firmianay](https://github.com/firmianay)
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@ sudo ./emba.sh -l ./log -f /firmware -p ./scan-profiles/default-scan.emba

## Get involved
The IoT is growing, the development is ongoing, and there are many new features that we want to add.
We welcome [pull requests](https://github.com/e-m-b-a/emba/pulls) and [issues](https://github.com/e-m-b-a/emba/issues) on GitHub.
We welcome [pull requests](https://github.com/e-m-b-a/emba/pulls) and [issues](https://github.com/e-m-b-a/emba/issues) on GitHub. Also check the [CONTRIBUTING](./CONTRIBUTING.md) and [CONTRIBUTORS](./CONTRIBUTORS.md) documentation for further information.

## Team

https://github.com/orgs/e-m-b-a/people
30 changes: 27 additions & 3 deletions check_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SOURCES=()
MODULES_TO_CHECK_ARR=()
MODULES_TO_CHECK_ARR_TAB=()
MODULES_TO_CHECK_ARR_SEMGREP=()
MODULES_TO_CHECK_ARR_DOCKER=()

import_config_scripts() {
mapfile -t HELPERS < <(find "$CONF_DIR" -iname "*.sh" 2>/dev/null)
Expand Down Expand Up @@ -101,9 +102,22 @@ import_installer() {
done
}

dockerchecker() {
echo -e "\\n""$ORANGE""$BOLD""EMBA docker-files check""$NC""\\n""$BOLD""=================================================================""$NC"
mapfile -t DOCKER_COMPS < <(find . -maxdepth 1 -iname "docker-compose*.yml")
for DOCKER_COMP in "${DOCKER_COMPS[@]}"; do
echo -e "\\n""$GREEN""Run docker check on $DOCKER_COMP:""$NC""\\n"
if docker-compose -f "$DOCKER_COMP" config 1>/dev/null || [[ $? -ne 1 ]]; then
echo -e "$GREEN""$BOLD""==> SUCCESS""$NC""\\n"
else
echo -e "\\n""$ORANGE$BOLD==> FIX ERRORS""$NC""\\n"
((MODULES_TO_CHECK=MODULES_TO_CHECK+1))
MODULES_TO_CHECK_ARR_DOCKER+=( "$DOCKER_COMP" )
fi
done
}

check()
{
check() {
echo -e "\\n""$ORANGE""$BOLD""Embedded Linux Analyzer Shellcheck""$NC""\\n""$BOLD""=================================================================""$NC"

echo -e "\\n""$GREEN""Run shellcheck on this script:""$NC""\\n"
Expand Down Expand Up @@ -193,10 +207,19 @@ summary() {
done
echo -e "$ORANGE""WARNING: Fix the errors before pushing to the EMBA repository!"
fi
if [[ "${#MODULES_TO_CHECK_ARR_DOCKER[@]}" -gt 0 ]]; then
echo -e "\\n\\n""$GREEN$BOLD""SUMMARY:$NC\\n"
echo -e "Modules to check (docker-compose): ${#MODULES_TO_CHECK_ARR_DOCKER[@]}\\n"
for MODULE in "${MODULES_TO_CHECK_ARR_DOCKER[@]}"; do
echo -e "$ORANGE$BOLD==> FIX MODULE: ""$MODULE""$NC"
done
echo -e "$ORANGE""WARNING: Fix the errors before pushing to the EMBA repository!"
fi

}

# check that all tools are installed
check_tools(){
check_tools() {
TOOLS=("semgrep" "shellcheck")
for TOOL in "${TOOLS[@]}";do
if ! command -v "$TOOL" > /dev/null ; then
Expand All @@ -213,5 +236,6 @@ check_tools(){
# main:
check_tools
check
dockerchecker
summary

4 changes: 2 additions & 2 deletions emba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ main()
print_output "[*] Loading EMBA scan profile." "no_log"
fi
# all profile output and settings are done by the profile file located in ./scan-profiles/
# shellcheck disable=SC1090
# shellcheck source=/dev/null
source "$PROFILE"
print_output "[*] Profile $PROFILE loaded." "no_log"
print_bar "no_log"
Expand All @@ -640,7 +640,7 @@ main()
print_output "[!] Found restart file and backup_vars file ... trying to restart EMBA scan" "no_log"
export RESTART=1
rm "$TMP_DIR"/restart
# shellcheck disable=SC1091
# shellcheck source=/dev/null
source "$LOG_DIR""/backup_vars.log"
fi
fi
Expand Down
1 change: 1 addition & 0 deletions helpers/helpers_emba_dependency_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ dependency_check()
check_dep_tool "Nmap portscanner" "nmap"
check_dep_tool "hping3" "hping3"
check_dep_tool "ping" "ping"
check_dep_tool "Metasploit framework" "msfconsole"
# This port is used by our Qemu installation and should not be used by another process.
# This check is not a blocker for the test. It is checked again by the emulation module:
check_emulation_port "Running Qemu service" "2001"
Expand Down
6 changes: 3 additions & 3 deletions helpers/helpers_emba_path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ mod_path_array() {

create_log_dir() {
if ! [[ -d "$LOG_DIR" ]] ; then
mkdir "$LOG_DIR" 2> /dev/null || true
mkdir "$LOG_DIR" || (print_output "[!] WARNING: Cannot create log directory" "no_log" && exit 1)
fi
if ! [[ -d "$TMP_DIR" ]] ; then
mkdir "$TMP_DIR" 2> /dev/null || true
mkdir "$TMP_DIR" || (print_output "[!] WARNING: Cannot create log directory" "no_log" && exit 1)
fi
if ! [[ -d "$CSV_DIR" ]]; then
mkdir "$CSV_DIR" 2> /dev/null || true
mkdir "$CSV_DIR" || (print_output "[!] WARNING: Cannot create log directory" "no_log" && exit 1)
fi

if [[ $FIRMWARE -eq 1 ]] ; then
Expand Down
Loading