Skip to content

Commit 5aa6dea

Browse files
World wide web
1 parent a1bc396 commit 5aa6dea

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

0x10-https_ssl/0-world_wide_web

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env bash
2-
# transfer file to our remote server
2+
# print domains and subdomains
33

4-
if [ $# -lt 3 ]
4+
print_domain_subdomain () {
5+
dig "$1" | grep -A1 'ANSWER SECTION:' | sed -r "s/$1./$2/g" | awk -F" " ' NR==2 { print "The subdomain " $1 " is a " $4 " record and points to " $5 }'
6+
}
7+
8+
if [ "$#" -eq 2 ]
59
then
6-
echo "Usage: 0-transfer_file PATH_TO_FILE IP USERNAME PATH_TO_SSH_KEY"
10+
print_domain_subdomain "$2.$1" "$2"
711
else
8-
if [ $# -eq 4 ]
9-
then
10-
scp -o StrictHostKeyChecking=no -i "$4" "$1" "$3"@"$2":~/
11-
else
12-
scp -o StrictHostKeyChecking=no "$1" "$3"@"$2":~/
13-
fi;
14-
fi;
12+
print_domain_subdomain "www.$1" "www"
13+
print_domain_subdomain "lb-01.$1" "lb-01"
14+
print_domain_subdomain "web-01.$1" "web-01"
15+
print_domain_subdomain "web-02.$1" "web-02"
16+
fi

0 commit comments

Comments
 (0)