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 import Shell, Account

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

    log_screen=False,
    log_file="~/mylog.txt",
    auto_priv_mode=False,
    debug=False,
    )
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.

Source Distribution

cannon-0.0.8.tar.gz (18.7 kB view hashes)

Uploaded Source

Built Distribution

cannon-0.0.8-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page