This file is indexed.

/usr/bin/pysnmpset is in python-pysnmp4-apps 0.2.6a-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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/python
#
# SET command generator
#
# Copyright 1999-2005 by Ilya Etingof <ilya@glas.net>.
#
import os
os.environ['PYSNMP_API_VERSION'] = 'v4'

import string, sys
from pysnmp_apps.cli import main, msgmod, secmod, target, pdu, mibview, base
from pysnmp.entity import engine
from pysnmp.entity.rfc3413 import cmdgen
from pysnmp import error

def getUsage():
    return "Usage: %s [OPTIONS] <AGENT> <PARAMETERS>\n\
%s%s%s%s%s%s" % (
        sys.argv[0],
        main.getUsage(),
        msgmod.getUsage(),
        secmod.getUsage(),
        mibview.getUsage(),
        target.getUsage(),
        pdu.getWriteUsage()
        )

# Construct c/l interpreter for this app

class Scanner(
    msgmod.MPScannerMixIn,
    secmod.SMScannerMixIn,
    mibview.MibViewScannerMixIn,
    target.TargetScannerMixIn,
    pdu.WritePduScannerMixIn,
    main.MainScannerMixIn,
    base.ScannerTemplate
    ): pass

class Parser(
    msgmod.MPParserMixIn,
    secmod.SMParserMixIn,
    mibview.MibViewParserMixIn,
    target.TargetParserMixIn,
    pdu.WritePduParserMixIn,
    main.MainParserMixIn,
    base.ParserTemplate
    ): pass

snmpEngine = engine.SnmpEngine()

try:
    # Parse c/l into AST
    ast = Parser().parse(
        Scanner().tokenize(string.join(sys.argv[1:], ' '))
        )

    ctx = {}

    # Apply configuration to SNMP entity
    main.generator((snmpEngine, ctx), ast)
    msgmod.generator((snmpEngine, ctx), ast)
    secmod.generator((snmpEngine, ctx), ast)    
    mibview.generator((snmpEngine, ctx), ast)
    target.generator((snmpEngine, ctx), ast)
    pdu.writePduGenerator((snmpEngine, ctx), ast)

except error.PySnmpError, why:
    sys.stderr.write('Error: %s\n%s' % (why, getUsage()))
    sys.exit(-1)
    
# Run SNMP engine

def cbFun(sendRequestHandle, errorIndication, errorStatus, errorIndex,
          varBinds, cbCtx):
    if errorIndication:
        sys.stderr.write('%s\n' % errorIndication)
    elif errorStatus:
        sys.stderr.write('%s\n' % errorStatus.prettyOut(errorStatus))
    else:
        for oid, val in varBinds:
            sys.stdout.write('%s\n' % cbCtx['mibViewProxy'].getPrettyOidVal(
                cbCtx['mibViewController'], oid, val
                ))

cmdgen.SetCommandGenerator().sendReq(
    snmpEngine, ctx['addrName'], ctx['varBinds'], cbFun, ctx
    )

try:
    snmpEngine.transportDispatcher.runDispatcher()
except error.PySnmpError, why:
    sys.stderr.write('Error: %s\n' % why)
    sys.exit(-1)