Skip to main content

cannon

Project description

Introduction

cannon is a wrapper around pexpect to connect with remote server or network devices with ssh.

Example Usage

from cannon.main import Shell, Account

sess = Shell(
    host='route-views.oregon-ix.net',
    credentials=(
        Account(user='rviews', passwd=''),
    ),

    log_screen=False,
    auto_priv_mode=False,
    debug=True,
    )
sess.execute('term len 0')
# template is a TextFSM template
values = sess.execute('show ip int brief',
    template="""Value INTF (\S+)\nValue IPADDR (\S+)\nValue STATUS (up|down|administratively down)\nValue PROTO (up|down)\n\nStart\n  ^${INTF}\s+${IPADDR}\s+\w+\s+\w+\s+${STATUS}\s+${PROTO} -> Record""")
print("VALUES "+str(values))
sess.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cannon, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size cannon-0.0.3-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size cannon-0.0.3.tar.gz (17.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page