This file is indexed.

/usr/share/pyshared/mumble/mucli.py is in python-django-mumble 2.10-2.

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
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; replace-tabs on;

"""
 *  Copyright (C) 2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
 *
 *  Mumble-Django is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This package is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
"""

DEFAULT_CONNSTRING = 'Meta:tcp -h 127.0.0.1 -p 6502'
DEFAULT_SLICEFILE  = '/usr/share/slice/Murmur.ice'

import os, sys
import inspect
import getpass

from optparse    import OptionParser
from mumble.mctl import MumbleCtlBase

usage = """Usage: %prog [options] [<method name>] [<method arguments>]

Each method argument has the form: [<data type: bool|int|float|string>:]value

If you do not specify a data type, string will be assumed, otherwise
`value' will be converted to the given type first. The bool conversion
interprets each of 'True', 'true', '1', 'Yes', 'yes' as True, everything else
as False.

    Example: int:4 float:3.5 string:oh:hai foobar bool:yes"""

parser = OptionParser(usage=usage)

parser.add_option( "-d", "--django-settings",
    help="if specified, get connstring and slice defaults from the given Django "
         "settings module. Default: empty.",
    default=None
    )

parser.add_option( "-c", "--connstring",
    help="connection string to use. Default is '%s'." % DEFAULT_CONNSTRING,
    default=None
    )

parser.add_option( "-i", "--icesecret",
    help="Ice secret to use in the connection. Also see --asksecret.",
    default=None
    )

parser.add_option( "-a", "--asksecret",
    help="Ask for the Ice secret on the shell instead of taking it from the command line.",
    action="store_true", default=False
    )

parser.add_option( "-s", "--slice",
    help="path to the slice file. Default is '%s'." % DEFAULT_SLICEFILE,
    default=None
    )

parser.add_option( "-e", "--encoding",
    help="Character set arguments are encoded in. Default: Read from LANG env variable with fallback to UTF-8.",
    default=None
    )

parser.add_option(
    "-v", "--verbose",
    help="Show verbose messages on stderr",
    default=False,
    action="store_true"
    )

options, progargs = parser.parse_args()

if options.django_settings is not None:
    if options.verbose:
        print >> sys.stderr, "Reading settings from module '%s'." % options.django_settings

    os.environ['DJANGO_SETTINGS_MODULE'] = options.django_settings
    from django.conf import settings

    if options.connstring is None:
        if options.verbose:
            print >> sys.stderr, "Setting connstring from settings module"
        options.connstring = settings.DEFAULT_CONN

    if options.slice is None:
        if options.verbose:
            print >> sys.stderr, "Setting slice from settings module"
        options.slice = settings.SLICE
else:
    if options.connstring is None:
        if options.verbose:
            print >> sys.stderr, "Setting default connstring"
        options.connstring = DEFAULT_CONNSTRING

    if options.slice is None:
        if options.verbose:
            print >> sys.stderr, "Setting default slice"
        options.slice = DEFAULT_SLICEFILE


if options.encoding is None:
    try:
        locale = os.environ['LANG']
        _, options.encoding = locale.split('.')
    except (KeyError, ValueError):
        options.encoding = "UTF-8"


if options.verbose:
    print >> sys.stderr, "Connection info:"
    print >> sys.stderr, "    Connstring: %s" % options.connstring
    print >> sys.stderr, "    Slice:      %s" % options.slice
    print >> sys.stderr, "Encoding:       %s" % options.encoding

if options.asksecret or options.icesecret == '':
    options.icesecret = getpass.getpass( "Ice secret: " )

ctl = MumbleCtlBase.newInstance( options.connstring, options.slice, options.icesecret )


if not progargs:
    # Print available methods.
    for method in inspect.getmembers( ctl ):
        if method[0][0] == '_' or not callable( method[1] ):
            continue

        if hasattr( method[1], "innerfunc" ):
            args = inspect.getargspec( method[1].innerfunc )[0]
        else:
            args = inspect.getargspec( method[1] )[0]

        if len( args ) > 1:
            if args[0] == 'self':
                print "%s( %s )" % ( method[0], ', '.join( args[1:] ) )
        else:
            print "%s()" % method[0]

else:
    # function name given. check if its args matches ours, if yes call it, if not print usage
    if options.verbose:
        print >> sys.stderr, "Method name:    %s" % progargs[0]

    method = getattr( ctl, progargs[0] )
    bound = True
    if hasattr( method, "innerfunc" ):
        method = method.innerfunc
        bound = False

    args = inspect.getargspec( method )[0]

    if len(progargs) == len(args) and args[0] == 'self':
        if len(args) == 1:
            print method(ctl)
        else:
            cleanargs = []
            for param in progargs[1:]:
                try:
                    argtype, argval = param.split(':', 1)
                except ValueError:
                    cleanargs.append( param.decode(options.encoding) )
                else:
                    cleanval = {
                      'bool':   lambda val: val in ('True', 'true', '1', 'Yes', 'yes'),
                      'int':    int,
                      'float':  float,
                      'string': str
                      }[ argtype ]( argval )

                    if argtype == 'string':
                        cleanval = cleanval.decode(options.encoding)
                    cleanargs.append(cleanval)

            if options.verbose:
                print >> sys.stderr, "Call arguments: %s" % repr(cleanargs)

            if bound:
                print method( *cleanargs )
            else:
                print method( ctl, *cleanargs )

    elif len(args) == 1:
        print >> sys.stderr, "Method '%s' does not take any arguments." % progargs[0]
        print >> sys.stderr, "Expected %s()" % progargs[0]

    else:
        print >> sys.stderr, "Invalid arguments for method '%s': %s" % ( progargs[0], ', '.join( progargs[1:] ) )
        print >> sys.stderr, "Expected %s( %s )" % ( progargs[0], ', '.join( args[1:] ) )