This file is indexed.

/usr/share/pyshared/d_rats/ax25.py is in d-rats 0.3.3-3ubuntu1.

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
bstr_pos = lambda n: n>0 and bstr_pos(n>>1)+str(n&1) or ''

class BitStuffContext:
    def __init__(self):
        self.outbound = ""
        self.register = 0
        self.bits = 0
        self.ones = 0

    def push(self):
        self.outbound += chr(self.register)
        self.register = self.bits = self.ones = 0

    def _store_bit(self, bit):
        self.register <<= 1
        if bit:
            self.register |= 0x01
            self.ones += 1
        else:
            self.ones = 0
        print "Register: %s" % bstr_pos(self.register)
        self.bits += 1
        if self.bits == 8:
            print "Pushing"
            self.push()

    def store_bit(self, bit):
        if bit and self.ones == 5:
            print "Stuffing!"
            self._store_bit(0)
        self._store_bit(bit)

    def get_output(self):
        if self.bits:
            for i in range(self.bits, 8):
                self.store_bit(0)
        return self.outbound

def bitstuff(data):
    ctx = BitStuffContext()

    for byte in data:
        for bit in range(0,8):
            ctx.store_bit(ord(byte) & (1 << bit))

    return ctx.get_output()

if __name__ == "__main__":
    from d_rats.utils import hexprint

    data = "\xFF\xFF\xFF"

    print "Start:"
    hexprint(data)

    print "\nStuffed:"
    hexprint(bitstuff(data))