For those that do not know, there exists two handy programs, Dynamips and Dynagen, that allow you to emulate certain Cisco routers using just the IOS file. Since the emulation is as the MIPS processor level, these programs are very useful for testing attacks against the routers themselves.
To install on Dynamips/Dynagen on Ubuntu, execute the following:
>sudo apt-get install dynamips
>sudo apt-get install dynagen
Next create the test.net file needed for dynagen:
[localhost][[7200]]
image = CISCO IMAGE LOCATION... i.e. c7200-is-mz.124-25f.bin
npe = npe-400
ram = 160
[[ROUTER R1]]
f0/0 = NIO_linux_eth:eth0
Just be sure to add the path to the bin file on the image line.
I created the following script to simply spawn a Dynamips subprocess and open Dynagen:
#!/usr/bin/python import subprocess import shlex import time import sys def executecmd(cmd):args= shlex.split(cmd)
pcmd = subprocess.Popen(args) if(len(sys.argv) == 2 or 3):
if sys.argv[1].lower() == "start":
#starting dynamips and waiting 3 seconds
executecmd("sudo dynamips -H 7200 &")
time.sleep(3)
#starting dynagen and waiting 3 seconds
executecmd("sudo dynagen " + sys.argv[2])
time.sleep(3)
if sys.argv[1].lower() == "kill":
print "stopping processes"
#stopping dynamips and waiting 3 seconds
executecmd("killall -9 dynamips")
time.sleep(3)
#stopping dynagen and waiting 3 seconds
executecmd("killall -9 dynagen")
else:
print "usage: sudo python" + sys.argv[0] + "<start <test.net file location>| kill>"
print "example: sudo python run_dynagen.py start /home/user1/test.net"
To telnet to the “console” of the router just execute the following through the linux command line:
>sudo telnet localhost 2000
All that’s left to do is program the router then you can access via telnet or attack through eth0.








Follow Us on Twitter