-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtarget_setup.sh
54 lines (44 loc) · 1.16 KB
/
target_setup.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
54
#!/bin/bash
# Make sure required tools are up-to-date before runtime
~/go/bin/subfinder -update
# Initialize Variables
TARGET_TLD=""
PROJECT=""
ZONE=""
DIR=$(pwd)
# Generic Error to stdout message
handle_exceptions() {
echo "An error occurred while processing the options."
exit 1
}
# Function to display usage instructions
display_help() {
echo "Usage: "$0" [-t <foo.com>] [-p <your-project-id>] [-z <us-south1-a>]" 1>&2
exit 1
}
# Parse Command-Line Args
while getopts ":t:p:z:" opt; do
case "${opt}" in
t)
TARGET_TLD=${OPTARG}
;;
p)
PROJECT=${OPTARG}
;;
z)
ZONE=${OPTARG}
;;
*)
handle_exceptions
;;
esac
done
shift $((OPTIND-1))
# Check all flags are set
if [ -z "${TARGET_TLD}" ] || [ -z "${PROJECT}" ] || [ -z "${ZONE}" ]; then
usage
fi
mkdir /"$DIR"/output
mkdir /"$DIR"/output/"$TARGET_TLD"
~/go/bin/subfinder -provider-config /"$HOME"/.config/subfinder/provider-config.yaml -d "$TARGET_TLD" -o /"$DIR"/output/"$TARGET_TLD"/"$TARGET_TLD".txt
nohup /bin/bash gcp-genie.sh -t "$TARGET_TLD" -p "$PROJECT" -z "$ZONE" &