Initial commit
authorZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Sat, 21 Nov 2015 18:19:03 +0000 (13:19 -0500)
committerZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Sat, 21 Nov 2015 18:19:03 +0000 (13:19 -0500)
.gitignore [new file with mode: 0644]
README [new file with mode: 0644]
generate-hosts.py [new file with mode: 0755]
hosts.in [new file with mode: 0644]
requirements.txt [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..a89d1df
--- /dev/null
@@ -0,0 +1,5 @@
+# Ignore virtualenv
+.venv
+
+# Ignore the generated file
+hosts
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..aa3cb45
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+INSTALL
+-------
+
+$ virtualenv .venv
+$ . .venv/bin/activate
+$ pip install -r requirements.txt
+
+GENERATE
+--------
+
+$ . .venv/bin/activate
+$ ./generate_hosts.py < hosts.in
diff --git a/generate-hosts.py b/generate-hosts.py
new file mode 100755 (executable)
index 0000000..6a09862
--- /dev/null
@@ -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))
diff --git a/hosts.in b/hosts.in
new file mode 100644 (file)
index 0000000..481beb2
--- /dev/null
+++ b/hosts.in
@@ -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
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..648b2ef
--- /dev/null
@@ -0,0 +1,3 @@
+argparse==1.2.1
+dnspython==1.12.0
+wsgiref==0.1.2