Open wrgeorge1983 opened 9 years ago
def methods(o): ... pprint.pprint([e for e in dir(o) if e[0] != '_'])
New interactive subclass (prefer lowercase for typing, tab completion)
sw = clinteractiveSwitch(ip='10.10.10.1', creds=creds) # first instance needs to be complete
sw2 =clinteractiveSwitch('10.10.10.2') # infers credentials
sw3 =clinteractiveSwitch('10.3') # infers leading octets (however many are needed to make it whole)
sw4 = clinteractiveSwitch(4) # integer assumed to be single trailing octet
sw4.pexecute('sh ip int bri') # print output, instead of return
There's enough modules for specific common tasks. Most of the improvement from this point will be in enabling rapid utilization of the framework for whatever.
Focus on being able to import the modules and use python as an interactive shell for rapid collection and analysis.
Look at using this inside IPython?bpythonLook at pysh? or something similarIf I can have tab completion of class members/attributes, I will literally, figuratively, die.cmd (the module) doesn't really look like what I'm after.python.rc? (or whatever it's called).pythonrc.pymaybe just have a module called sshinteractive?bpython -i interactive.pynewip() to turn 'x.x' to 'classB.prefix.x.x' (just ip() for fewer keystrokes?)def ipm(site, ip): # intelligently overwrite the trailing octets of an address
ip = 'xxx.xxx.xx.xx'; creds = sshutil.GetCredentials(); sw = sshutil.clSwitch(ip=ip, creds=creds)