-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
107 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
gvmd=v24.0.0 | ||
gvm_libs=v22.14.0 | ||
openvas=v23.13.1 | ||
gvmd=v24.1.2 | ||
gvm_libs=v22.15.0 | ||
openvas=v23.13.2 | ||
openvas_smb=v22.5.6 | ||
notus_scanner=v22.6.5 | ||
gsa=v24.0.1 | ||
gsad=v24.0.0 | ||
gsa=v24.1.0 | ||
gsad=v24.1.0 | ||
ospd=v21.4.4 | ||
ospd_openvas=v22.7.1 | ||
pg_gvm=v22.6.5 | ||
python_gvm=v24.11.0 | ||
gvm_tools=v24.12.0 | ||
pg_gvm=v22.6.6 | ||
python_gvm=v24.12.0 | ||
gvm_tools=v24.12.1 | ||
greenbone_feed_sync=v24.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
# Path to the docker-compose file in the "compose" folder | ||
# This compose should also have one or two of the scannable images running. | ||
COMPOSE_FILE_PATH="compose/docker-compose.yaml" | ||
|
||
# GVM Credentials | ||
GVM_USER="admin" | ||
GVM_PASS="admin" | ||
|
||
# Target settings for the scan | ||
TARGET_NAME="Scannable Target" | ||
TARGET_IP="scannable" # Or the subnet of the docker containers. (Can we extract this from docker?) | ||
SCAN_NAME="Test Scan" | ||
SCAN_CONFIG="daba56c8-73ec-11df-a475-002264764cea" # Full and fast config ID | ||
|
||
# Helper function to wait for GVM readiness | ||
wait_for_gvm() { | ||
echo "Waiting for GVM to initialize..." | ||
for i in {1..30}; do | ||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:9392 | grep -q "200"; then | ||
echo "GVM is up and running." | ||
return 0 | ||
fi | ||
sleep 10 | ||
done | ||
echo "GVM did not start in time." | ||
return 1 | ||
} | ||
|
||
# Start Docker containers | ||
start_containers() { | ||
echo "Starting Docker containers..." | ||
docker-compose -f $COMPOSE_FILE_PATH up -d | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to start containers." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Create a target using gvm-tools | ||
create_target() { | ||
echo "Creating a target in GVM..." | ||
gvm-cli tls --hostname localhost --port 9390 --gmp-username $GVM_USER --gmp-password $GVM_PASS << EOF | ||
<create_target> | ||
<name>$TARGET_NAME</name> | ||
<hosts>$TARGET_IP</hosts> | ||
</create_target> | ||
EOF | ||
} | ||
|
||
# Create and execute a scan using gvm-tools | ||
create_and_run_scan() { | ||
echo "Creating and executing a scan..." | ||
gvm-cli tls --hostname localhost --port 9390 --gmp-username $GVM_USER --gmp-password $GVM_PASS << EOF | ||
<create_task> | ||
<name>$SCAN_NAME</name> | ||
<comment>Automated test scan</comment> | ||
<config id="$SCAN_CONFIG"/> | ||
<target id="$(gvm-cli tls --hostname localhost --port 9390 --gmp-username $GVM_USER --gmp-password $GVM_PASS --xml '<get_targets/>' | grep -oP '(?<=id=")[^"]+')"/> | ||
</create_task> | ||
EOF | ||
|
||
echo "Launching scan..." | ||
gvm-cli tls --hostname localhost --port 9390 --gmp-username $GVM_USER --gmp-password $GVM_PASS << EOF | ||
<start_task> | ||
<task id="$(gvm-cli tls --hostname localhost --port 9390 --gmp-username $GVM_USER --gmp-password $GVM_PASS --xml '<get_tasks/>' | grep -oP '(?<=id=")[^"]+')"/> | ||
</start_task> | ||
EOF | ||
} | ||
|
||
# Clean up Docker containers | ||
cleanup() { | ||
echo "Cleaning up Docker containers..." | ||
docker-compose -f $COMPOSE_FILE_PATH down | ||
} | ||
|
||
# Main script execution | ||
trap cleanup EXIT | ||
start_containers | ||
if wait_for_gvm; then | ||
create_target | ||
create_and_run_scan | ||
else | ||
echo "Exiting due to GVM initialization failure." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Fri Dec 6 02:31:55 AM UTC 2024 | ||
Thu Dec 12 02:31:48 AM UTC 2024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Greenbone Versions in Latest image: # | ||
Component | Version | | Component | Version | ||
----------|----------|-|----------|--------- | ||
| gvmd | v24.0.0 | | gvm_libs | v22.14.0 | | ||
| openvas | v23.13.1 | | openvas_smb | v22.5.6 | | ||
| notus_scanner | v22.6.5 | | gsa | v24.0.1 | | ||
| gsad | v24.0.0 | | ospd | v21.4.4 | | ||
| ospd_openvas | v22.7.1 | | pg_gvm | v22.6.5 | | ||
| python_gvm | v24.11.0 | | gvm_tools | v24.12.0 | | ||
| gvmd | v24.1.2 | | gvm_libs | v22.15.0 | | ||
| openvas | v23.13.2 | | openvas_smb | v22.5.6 | | ||
| notus_scanner | v22.6.5 | | gsa | v24.1.0 | | ||
| gsad | v24.1.0 | | ospd | v21.4.4 | | ||
| ospd_openvas | v22.7.1 | | pg_gvm | v22.6.6 | | ||
| python_gvm | v24.12.0 | | gvm_tools | v24.12.1 | | ||
| greenbone_feed_sync | v24.9.0 | |