-
Notifications
You must be signed in to change notification settings - Fork 2
/
domain2ip.sh
49 lines (44 loc) · 1.08 KB
/
domain2ip.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
#!/bin/bash
function domain2ip() {
for A_DOMAIN in ${DOMAINS[*]}; do
AN_IPV4=$(dig ${A_DOMAIN} -4 +short | awk '{if($0!~"[a-z]")print}' | head -1)
echo "${AN_IPV4} ${A_DOMAIN}" | tee -a hosts
done
}
function main() {
DOMAINS=(
"api.github.com"
"atom.io"
"classroom.github.com"
"cli.github.com"
"codeload.github.com"
"desktop.github.com"
"docs.github.com"
"education.github.com"
"electronjs.org"
"gist.github.com"
"github.blog"
"github.com"
"github.community"
"github.dev"
"githubstatus.com"
"lab.github.com"
"octoverse.github.com"
"pages.github.com"
"partner.github.com"
"primer.style"
"raw.githubusercontent.com"
"resources.github.com"
"services.github.com"
"skills.github.com"
"socialimpact.github.com"
"support.github.com"
"thegithubshop.com"
"vscode.github.com"
)
if [ -f "hosts" ]; then
rm hosts
fi
domain2ip
}
main