| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| eve-ng [2025/12/14 12:29] – Name | eve-ng [2025/12/14 14:03] (current) – Name |
|---|
| * Paste into CiscoIOUKeygen.py (should be an empty file first) | * Paste into CiscoIOUKeygen.py (should be an empty file first) |
| * <code>print("*********************************************************************") | * <code>print("*********************************************************************") |
| print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version") | print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version. Modified by Timothy C. Fox 2025. https://tim.army") |
| import os | import os |
| import socket | import socket |
| md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1 | md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1 |
| iouLicense=hashlib.md5(md5input).hexdigest()[:16] | iouLicense=hashlib.md5(md5input).hexdigest()[:16] |
| | |
| print("\nAdd the following text to ~/.iourc:") | # Add to .iourc file |
| print("[license]\n" + hostname + " = " + iouLicense + ";\n") | #print("\nAdd the following text to /opt/unetlab/addons/iol/bin/.iourc:") |
| with open("iourc.txt", "wt") as out_file: | #print("[license]\n" + hostname + " = " + iouLicense + ";\n") |
| | with open("/opt/unetlab/addons/iol/bin/.iourc", "wt") as out_file: |
| out_file.write("[license]\n" + hostname + " = " + iouLicense + ";\n") | out_file.write("[license]\n" + hostname + " = " + iouLicense + ";\n") |
| print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nCopied to the file iourc.txt\n ") | print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nCopied to the file /opt/unetlab/addons/iol/bin/.iourc\n ") |
| | |
| | #print("The old way of disabling the call home feature was by editing the host file.") |
| | #print("That method no longer works with the x86_64_crb_linux images. The new way is the following:") |
| | #print("You can disable the phone home feature by:") |
| | #print("iptables -I OUTPUT -p udp --dport 53 -m string --hex-string \"|03|xml|05|cisco|03|com\" --algo bm -j DROP") |
| | |
| | # Add the following to iptables to block Cisco Call-Home and set the timeout value to 10 seconds |
| | os.system('timeout 10 iptables -I OUTPUT -p udp --dport 53 -m string --hex-string "|03|xml|05|cisco|03|com" --algo bm -j DROP') |
| | |
| | # Display the iptables |
| | os.system('iptables -L') |
| | |
| | print("if the line is duplicated, then execute the following:") |
| | print("iptables -L OUTPUT -p udp --dport 53 -m string --hex-string \"|03|xml|05|cisco|03|com\" --algo bm -j DROP") |
| | |
| | # Fix permissions and set the timeout value to 60 seconds |
| | print("Fixing permissions . . . standby") |
| | os.system('timeout 60 /opt/unetlab/wrappers/unl_wrapper -a fixpermissions') |
| | print("Permissions fixed")</code> |
| |
| print("The old way of disabling the call home feature was by editing the | Execute the Python script |
| host file. That method no longer works with the x86_64_crb_linux images. | |
| The new way is the following:") | |
| print("You can disable the phone home feature by:") | |
| print("echo 'iptables -I OUTPUT -p udp --dport 53 -m string --hex-string | |
| "|03|xml|05|cisco|03|com" --algo bm -j DROP'")</code> | |
| * <code>python3 /opt/unetlab/addons/iol/bin/CiscoIOUKeygen.py</code> | * <code>python3 /opt/unetlab/addons/iol/bin/CiscoIOUKeygen.py</code> |
| | To Fix Permissions |
| * <code>/opt/unetlab/wrappers/unl_wrapper -a fixpermissions</code> | * <code>/opt/unetlab/wrappers/unl_wrapper -a fixpermissions</code> |
| |