This file is indexed.

/usr/share/doc/python-ncclient/examples/get-session-params.py is in python-ncclient 0.4.7-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python

from ncclient import manager
from ncclient.transport import errors


def connect(host, port, user, password, source):
    try:
        conn = manager.connect(host=host,
                port=port,
                username=user,
                password=password,
                timeout=10,
                device_params = {'name':'junos'},
            hostkey_verify=False)

        print 'connected:', conn.connected, ' .... to host', host, 'on port:', port
        print 'session-id:', conn.session_id
        print 'client capabilities:'
        for i in conn.client_capabilities:
            print ' ', i
        print 'server capabilities:'
        for i in conn.server_capabilities:
            print ' ', i
        conn.close_session()
    except errors.SSHError:
        print 'Unable to connect to host:', host, 'on port:', port


if __name__ == '__main__':
    connect('router', 830, 'netconf', 'juniper!', 'candidate')
    connect('router', 831, 'netconf', 'juniper!', 'candidate')
    connect('router', 830, 'netconf', 'juniper!', 'candidate')