This file is indexed.

/usr/share/checkbox/scripts/mago_filter is in checkbox 0.13.7.

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
#!/usr/bin/python

import sys

from xml.dom import minidom

from optparse import OptionParser


def print_line(key, value):
    print "%s: %s" % (key, value)

def print_element(element):
    for key, value in element.items():
        print_line(key, value)

    print

def parse_file(file):
    elements = []
    default_status = "pass"
    tree = minidom.parse(file)
    for suite in tree.getElementsByTagName("suite"):
        element = {}
        element["plugin"] = "local"
        element["status"] = default_status
        element["name"] = suite.getAttribute("name")
        for child in suite.childNodes:
            if child.nodeName == "description":
                element["description"] = child.firstChild.data.strip()
            elif child.nodeName == "result":
                for subchild in child.childNodes:
                    if subchild.nodeName == "pass":
                        data = subchild.firstChild.data
                        element["status"] = data == "1" and "pass" or "fail"
                    elif subchild.nodeName == "error":
                        element["status"] = "fail"

                if element["status"] == "fail":
                    default_status = "unresolved"

        elements.append(element)

        for case in suite.getElementsByTagName("case"):
            element = {}
            element["plugin"] = "shell"
            element["status"] = default_status
            element["suite"] = suite.getAttribute("name")
            element["name"] = case.getAttribute("name")
            for child in case.childNodes:
                if child.nodeName == "description":
                    element["description"] = child.firstChild.data.strip()
                elif child.nodeName == "result":
                    for subchild in child.childNodes:
                        if subchild.nodeName == "time":
                            data = subchild.firstChild.data
                            element["duration"] = float(data)
                        elif subchild.nodeName == "message":
                            element["data"] = subchild.firstChild.data
                        elif subchild.nodeName == "pass":
                            data = subchild.firstChild.data
                            element["status"] = data == "1" and "pass" or "fail"
                        elif subchild.nodeName == "error":
                            element["status"] = "fail"

            elements.append(element)

    return elements

def parse_files(files):
    elements = []
    for file in files:
        elements.extend(parse_file(file))

    return elements

def main(args):
    usage = "Usage: %prog [FILE...]"
    parser = OptionParser(usage=usage)
    (options, args) = parser.parse_args(args)

    if not args:
        files = [sys.stdin]
    else:
        files = args

    elements = parse_files(files)
    if not elements:
        return 1

    for element in elements:
        print_element(element)

    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))