-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-host.py
More file actions
47 lines (39 loc) · 1.49 KB
/
Copy pathgit-host.py
File metadata and controls
47 lines (39 loc) · 1.49 KB
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
#!/usr/bin/env python
# coding:utf-8
import socket
def output_hosts():
domains = ['github.com',
'gist.github.com',
'assets-cdn.github.com',
'raw.githubusercontent.com',
'gist.githubusercontent.com',
'cloud.githubusercontent.com',
'camo.githubusercontent.com',
'avatars0.githubusercontent.com',
'avatars1.githubusercontent.com',
'avatars2.githubusercontent.com',
'avatars3.githubusercontent.com',
'avatars4.githubusercontent.com',
'avatars5.githubusercontent.com',
'avatars6.githubusercontent.com',
'avatars7.githubusercontent.com',
'avatars8.githubusercontent.com',
'avatars.githubusercontent.com',
'github.githubassets.com',
'user-images.githubusercontent.com',
'codeload.github.com',
'favicons.githubusercontent.com',
'api.github.com'
]
with open('hosts.txt', 'w') as f:
f.write('\n')
f.write('# GitHub Start \n')
for domain in domains:
print('Querying ip for domain %s'%domain)
ip = socket.gethostbyname(domain)
print(ip)
f.write('%s %s\n'%(ip, domain))
f.write('# GitHub End \n')
f.write('\n')
if __name__ == '__main__':
output_hosts()