Skip to content

Commit

Permalink
Updates from GB
Browse files Browse the repository at this point in the history
  • Loading branch information
immauss committed Dec 12, 2024
1 parent ce25664 commit 551798d
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 21 deletions.
12 changes: 6 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ v1.0 | old out of date image for posterity. (Dont` use this one. . .
# 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.11.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 |

# 25 August 2023 #
Expand Down
16 changes: 8 additions & 8 deletions build.rc
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
86 changes: 86 additions & 0 deletions testing/openvas-test.sh
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
2 changes: 1 addition & 1 deletion update.ts
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
12 changes: 6 additions & 6 deletions versions.md
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 |

0 comments on commit 551798d

Please sign in to comment.