Popular Python recipes tagged "meta:requires=telnetlib"http://code.activestate.com/recipes/langs/python/tags/meta:requires=telnetlib/2009-05-27T01:24:12-07:00ActiveState Code RecipesAutomated management of CLI devices (Python) 2009-05-27T01:24:12-07:00Alan Holthttp://code.activestate.com/recipes/users/4170480/http://code.activestate.com/recipes/576778-automated-management-of-cli-devices/ <p style="color: grey"> Python recipe 576778 by <a href="/recipes/users/4170480/">Alan Holt</a> (<a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/management/">management</a>, <a href="/recipes/tags/ssh/">ssh</a>, <a href="/recipes/tags/telnet/">telnet</a>, <a href="/recipes/tags/tunnel/">tunnel</a>). </p> <p>This recipe provides a mechanism for remote, automated control of a network device via its command-line interface (CLI). It assumes that the CLI is accessed using Telnet. Furthermore, the device cannot be accessed directly, instead the user has to SSH to an intermediate jump host before Telneting to the device. </p> Exectute shell command on Remote *nix machine (Python) 2008-07-18T02:20:22-07:00winterTTr Donghttp://code.activestate.com/recipes/users/4164498/http://code.activestate.com/recipes/576363-exectute-shell-command-on-remote-nix-machine/ <p style="color: grey"> Python recipe 576363 by <a href="/recipes/users/4164498/">winterTTr Dong</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>Use telnetlib to execute the shell command from localhost.</p> <p>An example to show the funciton. Output the result to result.log.</p> <p>from PyRemoteControl import RemoteShellCommand</p> <h4>host info</h4> <p>host_ip = '192.168.32.72' user_name = 'fw' password = 'fw' result_file = 'result.log'</p> <h4>command List</h4> <p>cmdList = [ 'cd' , 'll' ]</p> <h4>init</h4> <p>cursor = RemoteShellCommand( host_ip , user_name , password , result_file ) cursor.AddPrompt( '[fw@localhost .<em>]\$ ') cursor.AddPrompt( '[root@localhost .</em>]# ' )</p> <h4>connect to Linux</h4> <p>cursor.Login()</p> <h4>change to root</h4> <p>cursor.SendInterActiveCmd( 'su - ' , [ ('Password: ' , 'rootPassord')] , False)</p> <h4>Exec Command</h4> <p>for cmd in cmdList : cursor.SendCmd( cmd )</p> <h4>logout</h4> <p>cursor.Logout()</p> Automate performance monitoring via telnet and ftp in a production environment (Python) 2006-10-24T23:07:29-07:00Victor Yanghttp://code.activestate.com/recipes/users/627255/http://code.activestate.com/recipes/498210-automate-performance-monitoring-via-telnet-and-ftp/ <p style="color: grey"> Python recipe 498210 by <a href="/recipes/users/627255/">Victor Yang</a> (<a href="/recipes/tags/network/">network</a>). Revision 2. </p> <p>This code snippet shows how to kich off a performance data gathering shell script with telnetlib and download the data back to a local workstation with ftplib.</p> Remote control with telnetlib (Python) 2001-03-11T11:29:37-08:00Jeff Bauerhttp://code.activestate.com/recipes/users/98055/http://code.activestate.com/recipes/52228-remote-control-with-telnetlib/ <p style="color: grey"> Python recipe 52228 by <a href="/recipes/users/98055/">Jeff Bauer</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>Send commands to one or more logins using Python's standard telnetlib module.</p>