|
1 | 1 | #!/bin/bash |
2 | | -# Author: Omar Santos @santosomar |
3 | | -# Lame script to display the running containers in WebSploit |
| 2 | +# Author: Omar Santos (@santosomar) |
| 3 | +# Dynamic script to display running WebSploit containers and their IP addresses. |
4 | 4 |
|
| 5 | +# Clear the screen |
5 | 6 | clear |
6 | | -echo -e "\n\e[96mWebSploit\e[39m" |
7 | | -echo -e "by Omar Santos @santosomar" |
8 | | -echo -e "-------------------------------------" |
9 | | -echo -e "Internal Hacking Networks: 10.6.6.0/24 and 10.7.7.0/24" |
10 | | -echo -e "Your bridge networks:" |
11 | | -ip -c -brie a | grep 10.6.6.1 |
12 | | -ip -c -brie a | grep 10.7.7.1 |
13 | | - |
14 | | -echo -e " |
15 | | -The following are the WebSploit vulnerable containers and associated IP addresses. |
16 | | -+------------------------+------------+ |
17 | | -| Container | IP Address | |
18 | | -+------------------------+------------+ |
19 | | -| webgoat | 10.6.6.11 | |
20 | | -| juice-shop | 10.6.6.12 | |
21 | | -| dvwa | 10.6.6.13 | |
22 | | -| mutillidae_2 | 10.6.6.14 | |
23 | | -| dvna | 10.6.6.15 | |
24 | | -| hackazon | 10.6.6.16 | |
25 | | -| hackme-rtov | 10.6.6.17 | |
26 | | -| mayhem | 10.6.6.18 | |
27 | | -| rtv-safemode | 10.6.6.19 | |
28 | | -| galactic-archives | 10.6.6.20 | |
29 | | -| yascon-hackme | 10.6.6.21 | |
30 | | -| secretcorp-branch1 | 10.6.6.22 | |
31 | | -| gravemind | 10.6.6.23 | |
32 | | -| dc30_01 | 10.6.6.24 | |
33 | | -| dc30_01 | 10.6.6.25 | |
34 | | -| y-wing | 10.6.6.26 | |
35 | | -| dc31_01 | 10.7.7.21 | |
36 | | -| dc31_02 | 10.7.7.22 | |
37 | | -| dc31_03 | 10.7.7.23 | |
38 | | -+------------------------+------------+ " |
39 | | - |
40 | | -echo -e "The following are the \e[92mrunning \e[39mcontainers with their associated ports:" |
| 7 | + |
| 8 | +# Header |
| 9 | +echo -e "\n\e[96mWebSploit Lab Environment\e[39m" |
| 10 | +echo -e "by Omar Santos (@santosomar)" |
| 11 | +echo -e "-------------------------------------------" |
| 12 | +echo -e "Internal Hacking Networks: \e[93m10.6.6.0/24\e[39m and \e[93m10.7.7.0/24\e[39m\n" |
| 13 | + |
| 14 | +# Show bridge networks |
| 15 | +echo -e "Your configured bridge network interfaces:" |
| 16 | +ip -c -brie a | grep -E "10\.6\.6\.1|10\.7\.7\.1" || echo -e "\e[91mNo matching interfaces found.\e[39m" |
| 17 | + |
| 18 | +# Check if Docker is installed |
| 19 | +if ! command -v docker &> /dev/null; then |
| 20 | + echo -e "\n\e[91mDocker is not installed or not in your PATH.\e[39m" |
| 21 | + exit 1 |
| 22 | +fi |
| 23 | + |
| 24 | +# Check if Docker daemon is running |
| 25 | +if ! docker info &> /dev/null; then |
| 26 | + echo -e "\n\e[91mDocker is not running. Please start Docker.\e[39m" |
| 27 | + exit 1 |
| 28 | +fi |
| 29 | + |
| 30 | +# Function to get IP address of a container |
| 31 | +get_container_ip() { |
| 32 | + local container_name=$1 |
| 33 | + docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$container_name" |
| 34 | +} |
| 35 | + |
| 36 | +# List all WebSploit containers (you could filter with a prefix/tag if needed) |
| 37 | +echo -e "\n\e[96mDetected WebSploit Containers:\e[39m" |
| 38 | +printf "+------------------------+---------------+\n" |
| 39 | +printf "| %-22s | %-13s |\n" "Container" "IP Address" |
| 40 | +printf "+------------------------+---------------+\n" |
| 41 | + |
| 42 | +# Loop through running containers |
| 43 | +docker ps --format "{{.Names}}" | while read -r container; do |
| 44 | + ip=$(get_container_ip "$container") |
| 45 | + if [[ $ip == 10.6.6.* || $ip == 10.7.7.* ]]; then |
| 46 | + printf "| %-22s | %-13s |\n" "$container" "$ip" |
| 47 | + fi |
| 48 | +done |
| 49 | + |
| 50 | +printf "+------------------------+---------------+\n" |
| 51 | + |
| 52 | +# Show running containers with ports and status |
| 53 | +echo -e "\n\e[96mRunning Containers and Port Mappings:\e[39m" |
41 | 54 | docker ps --format "table {{.Names}}\t{{.Ports}}\t{{.Status}}" |
| 55 | + |
| 56 | +echo -e "\n\e[92mDone.\e[39m" |
0 commit comments