附源码:
#! /usr/bin/python3 print("*********************************************************************") print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version") print("Modified to work with python3 by c_d 2014") import os import socket import hashlib import struct # get the host id and host name to calculate the hostkey hostid=os.popen("hostid").read().strip() hostname = socket.gethostname() ioukey=int(hostid,16) for x in hostname: ioukey = ioukey + ord(x) print("hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2