This file is indexed.

/usr/share/pyshared/jsb/utils/exception.py is in jsonbot 0.84.4-1.

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

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
# jsb/utils/exception.py
#
#

""" exception related functions. """

## basic imports

import sys
import traceback
import logging
import thread
import os
import logging

## defines

bork = False
exceptionlist = []
exceptionevents = []

ERASE_LINE = '\033[2K'
BOLD='\033[1m'
RED = '\033[91m'
YELLOW = '\033[93m'
GREEN = '\033[92m'
ENDC = '\033[0m'


## exceptionmsg function

def exceptionmsg():
    """ create exception message as a string. """
    exctype, excvalue, tb = sys.exc_info()
    trace = traceback.extract_tb(tb)
    result = ""
    for i in trace:
        fname = i[0]
        linenr = i[1]
        func = i[2]
        plugfile = fname[:-3].split(os.sep)
        mod = []
        for i in plugfile[::-1]:
            if i in ['jsb.upload']: break
            mod.append(i)
            if i in ['jsb', 'waveapi', 'google', 'data']: break
        ownname = '.'.join(mod[::-1])
        result += "%s:%s %s | " % (ownname, linenr, func)
    del trace
    res = "%s%s: %s" % (result, exctype, excvalue)
    if res not in exceptionlist: exceptionlist.append(res)
    return res

## handle_exception function

def handle_exception(event=None, log=True, txt="", stop=False):
    """ handle exception.. for now only print it. """
    errormsg = exceptionmsg()
    if txt: errormsg = "%s - %s" % (txt, errormsg)
    if log: logging.error(RED + txt + " " + errormsg + ENDC)
    if event:
        exceptionevents.append((event, errormsg))
        if event.bot:
            event.bot.error = errormsg
            if event.bot.type == "irc": target = event.nick
            else: target = event.channel 
            if target: event.bot.saynocb(target, "*sorry* - an exception occured - %s" % errormsg)
    if stop or bork: os._exit(1)