Commits

buge  committed c894be0

Modified oui_gen to download oui list directly.

  • Participants
  • Parent commits 14d4bac

Comments (0)

Files changed (1)

 #!/usr/bin/env python
 
-import codecs
+from codecs import EncodedFile
+from urllib2 import urlopen
 
-input = codecs.open('oui.txt', 'r', 'latin-1', errors='replace')
+URI = "http://standards.ieee.org/develop/regauth/oui/oui.txt"
+input = EncodedFile(urlopen(URI), 'latin-1', errors='replace')
 
 output = open('oui.py', 'w')
 output.write("""# Copyright (C) 2011  Philipp Bunge
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
+\"\"\"Listing of Organizational Unique Idnentifiers (OUIs). An OUI is a
+24-bit globally unique number assigned by the IEEE standards
+organization. Organizations can concatenate their number with another,
+internally issued number, to create a 48-bit or 64-bit identifier to
+uniquelly identify a piece of hardware. This is used, for example, to
+create MAC addresses, Bluetooth device addresses and ethernet addresses.
+
+The numbers here are a derivation of the IEEE public OUI listing,
+available under
+http://standards.ieee.org/develop/regauth/oui/public.html.
+\"\"\"
+
 __all__ = [ 'OUIS' ] 
 
 OUIS = {
 """)
 
-#   awk '
-#   BEGIN {
-#       FS="[-\t ]"
-#       print "OUIS = {"
-#   }
-
-#   /(hex)/ {
-#       hex = $1 $2 $3
-#       name = substr($0, 19)
-#       printf("    0x%s: \"%s\",\n", hex, name) 
-#   }
-
-#   END {
-#       print "}"
-#       print
-#   }
-#   ' < oui.txt >> oui.py
-
-
 for l in input:
     if not "(hex)" in l:
         continue