Skip to content

Instantly share code, notes, and snippets.

@fredhsu
Created September 30, 2014 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredhsu/2430dcfbd9ba0d7c60c3 to your computer and use it in GitHub Desktop.
Save fredhsu/2430dcfbd9ba0d7c60c3 to your computer and use it in GitHub Desktop.
Simple eAPI script to try out different ip addresses on an interface. Starting a 3 and going until 254
import jsonrpclib
import time
name = "demo1"
switchReq = jsonrpclib.Server("http://admin:admin@" + name +
"/command-api")
for i in range(3,2545:
ipaddr = "ip address 2.2.2.{}/24".format(i)
response = switchReq.runCmds(1, ["enable", "configure", "interface ethernet 52", ipaddr])
print "trying " + ipaddr
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment