-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbot.sh
executable file
·53 lines (44 loc) · 1.36 KB
/
bbot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
add_volume_if_exists() {
local DIR_NAME="$1"
local MOUNT_POINT="$2"
local DOCKER_VOLUMES_VAR="$3"
if [ -d "$DIR_NAME" ]; then
local ABS_DIR_PATH
ABS_DIR_PATH=$(realpath "$DIR_NAME")
eval "$DOCKER_VOLUMES_VAR+=(-v \"$ABS_DIR_PATH:$MOUNT_POINT\")"
fi
}
OUTPUT_DIR=""
ARGS=("$@")
for ((i = 0; i < $#; i++)); do
if [ "${ARGS[$i]}" == "-o" ]; then
OUTPUT_DIR="${ARGS[$i+1]}"
break
fi
done
if [ -z "$OUTPUT_DIR" ]; then
OUTPUT_DIR="./output"
fi
ABS_OUTPUT_DIR=$(realpath "$OUTPUT_DIR")
NEW_ARGS=()
SKIP_NEXT=false
for arg in "${ARGS[@]}"; do
if [ "$SKIP_NEXT" = true ]; then
SKIP_NEXT=false
continue
fi
if [ "$arg" == "-o" ]; then
SKIP_NEXT=true
continue
fi
NEW_ARGS+=("$arg")
done
DOCKER_VOLUMES=()
DOCKER_VOLUMES+=("-v \"$ABS_OUTPUT_DIR:/root/output\"")
DOCKER_VOLUMES+=("-v \"$HOME/.bbot:/root/.bbot\"")
DOCKER_VOLUMES+=("-v \"$HOME/.config/bbot:/root/.config/bbot\"")
add_volume_if_exists "$HOME/Wordlists" "/root/Wordlists" DOCKER_VOLUMES
add_volume_if_exists "$HOME/cent-nuclei-templates/" "/root/cent-nuclei-template" DOCKER_VOLUMES
add_volume_if_exists "$HOME/nuclei-templates/" "/root/nuclei-template" DOCKER_VOLUMES
eval "docker run --network host --rm -it ${DOCKER_VOLUMES[@]} dockeronfullpc/fat-bbot:dev -o /root/output \"${NEW_ARGS[@]}\""