Guest User

Untitled

a guest
Aug 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #! /usr/bin/python
  2. print "*********************************************************************"
  3. print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version"
  4. import os
  5. import socket
  6. import hashlib
  7. import struct
  8. # get the host id and host name to calculate the hostkey
  9. hostid=os.popen("80804a6c").read().strip()
  10. hostname = socket.gethostname(peanut)
  11. ioukey=int(hostid,16)
  12. for x in hostname:
  13. ioukey = ioukey + ord(x)
  14. print "hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:]
  15. # create the license using md5sum
  16. iouPad1='\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
  17. iouPad2='\x80' + 39*'\0'
  18. md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1
  19. iouLicense=hashlib.md5(md5input).hexdigest()[:16]
  20. print "\nAdd the following text to ~/.iourc:"
  21. print "[license]\n" + hostname + " = " + iouLicense + ";\n"
  22. print "You can disable the phone home feature with something like:"
  23. print " echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n"
Add Comment
Please, Sign In to add comment