Initial commit

This commit is contained in:
Zachary Seguin 2015-11-21 13:19:03 -05:00
commit a1bc9c9f85
5 changed files with 184 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Ignore virtualenv
.venv
# Ignore the generated file
hosts

12
README Normal file
View File

@ -0,0 +1,12 @@
INSTALL
-------
$ virtualenv .venv
$ . .venv/bin/activate
$ pip install -r requirements.txt
GENERATE
--------
$ . .venv/bin/activate
$ ./generate_hosts.py < hosts.in

29
generate-hosts.py Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
import sys
import socket
import re
import dns.resolver
exp = re.compile('([^\.]+)')
if __name__ == '__main__':
for host in sys.stdin:
host = host.replace('\n', '')
if host == "" or host[0] == "#":
print(host)
continue
if host[0] == '!':
print(host[1:])
continue
try:
res = dns.resolver.query(host)
ip = socket.gethostbyname(str(res.qname))
print("{0}\t{1} {2}".format(ip, str(res.qname)[:-1], exp.match(host).group(0)))
except:
sys.stderr.write('Failed to get IP for: {0}\n'.format(host))

135
hosts.in Normal file
View File

@ -0,0 +1,135 @@
# localhost
!127.0.0.1 localhost
!::1 ip6-localhost ip6-loopback
!fe00::0 ip6-localnet
!ff00::0 ip6-mcastprefix
!ff02::1 ip6-allnodes
!ff02::2 ip6-allrouters
!ff02::3 ip6-allhosts
# Math Student Orgs Net
mathstudentorgs.net.uwaterloo.ca
mc-cs1-mathstudentorgsnet.uwaterloo.ca
mc-cs2-mathstudentorgsnet.uwaterloo.ca
mc-cs-cvl.net.uwaterloo.ca
# CSC - General Use
caffeine
corn-syrup
high-fructose-corn-syrup
hfcs
taurine
sucrose
potassium-nitrate
# CSC - Office Terminals
bit-shifter
gwem
maltodextrin
natural-flavours
nullsleep
sodium-benzoate
strombola
rainbowdragoneyes
goto80
# CSC - Syscom
auth1
auth2
ldap1
ldap2
kdc1
kdc2
kadmin
mail
aspartame
cobalamin
dextrose
glomag
psilodump
# CSC - Web
csclub
www
wiki
rt
git
mailman
munin
debian
mirror
# CSC - Testnodes
testnode1
testnode2
testnode3
testnode4
testnode5
# CSC - IPMI/LOM
mso-private.net.uwaterloo.ca
mc-cs1-mso-private.uwaterloo.ca
mc-cs2-mso-private.uwaterloo.ca
kvm
taurine-ilo
sodium-benzoate-ipmi
glomag-ipmi
corn-syrup-ipmi
#sucrose-ilo
#dextrose-ilo
!10.15.134.113 sucrose-ilo.csclub.uwaterloo.ca sucrose-ilo
!10.15.134.114 dextrose-ilo.csclub.uwaterloo.ca dextrose-ilo
cobalamin-ipmi
!10.15.134.155 high-fructose-corn-syrup-impi.csclub.uwaterloo.ca high-fructose-corn-syrup-impi
!10.15.134.155 hfcs-ipmi.csclub.uwaterloo.ca hfcs-ipmi
# CSC - Private
caffeine-private
glomag-private
taurine-private
corn-syrup-private
# CSC - Coder
coder01
coder02
coder03
coder04
coder05
coder06
coder07
coder08
coder09
# Mathsoc
www-stanton.mathsoc.uwaterloo.ca
mail-stanton.mathsoc.uwaterloo.ca
# CM Club
#staples.cmclub.uwaterloo.ca
paperclip.cmclub.uwaterloo.ca
#inkpen.cmclub.uwaterloo.ca
#waffles.cmclub.uwaterloo.ca
#muffins.cmclub.uwaterloo.ca
# WICS
honk.wics.uwaterloo.ca
hiss.wics.uwaterloo.ca
gosling.wics.uwaterloo.ca
mother-goose.wics.uwaterloo.ca
gander.wics.uwaterloo.ca
gaggle.wics.uwaterloo.ca

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
argparse==1.2.1
dnspython==1.12.0
wsgiref==0.1.2