fork download
  1. # your code goes here
  2. #! /usr/bin/python
  3. print("*********************************************************************")
  4. print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version")
  5. print("Modified to work with python3 by c_d 2014")
  6. import os
  7. import socket
  8. import hashlib
  9. import struct
  10.  
  11. # get the host id and host name to calculate the hostkey
  12. hostid="ac45d0c9"
  13. hostname = "gns3-iouvm"
  14. ioukey=int(hostid,16)
  15. for x in hostname:
  16. ioukey = ioukey + ord(x)
  17. print("hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:])
  18.  
  19. # create the license using md5sum
  20. iouPad1 = b'\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
  21. iouPad2 = b'\x80' + 39*b'\0'
  22. md5input=iouPad1 + iouPad2 + struct.pack('!L', ioukey) + iouPad1
  23. iouLicense=hashlib.md5(md5input).hexdigest()[:16]
  24.  
  25. print("\nAdd the following text to ~/.iourc:")
  26. print("[license]\n" + hostname + " = " + iouLicense + ";\n")
  27. print("You can disable the phone home feature with something like:")
  28. print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")# your code goes here
Success #stdin #stdout 0.02s 10332KB
stdin
Standard input is empty
stdout
*********************************************************************
Cisco IOU License Generator - Kal 2011, python port of 2006 C version
Modified to work with python3 by c_d 2014
hostid=ac45d0c9, hostname=gns3-iouvm, ioukey=ac45d4a1

Add the following text to ~/.iourc:
[license]
gns3-iouvm = 0747acb8906b0e05;

You can disable the phone home feature with something like:
 echo '127.0.0.127 xml.cisco.com' >> /etc/hosts