File: fake_ldd

package info (click to toggle)
apparmor 2.13.2-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,404 kB
  • sloc: python: 19,093; ansic: 17,037; perl: 11,105; sh: 10,442; cpp: 5,323; yacc: 1,933; makefile: 1,679; pascal: 1,097; lex: 1,088; ruby: 374; exp: 250; java: 212; xml: 159
file content (60 lines) | stat: -rwxr-xr-x 2,552 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/python3

import sys

if len(sys.argv) != 2:
    raise Exception('wrong number of arguments in fake_ldd')

if sys.argv[1] in ['/AATest/bin/bash', '/bin/bash', '/usr/bin/bash']:
    print('        linux-vdso.so.1 (0x00007ffcf97f4000)')
    print('        libreadline.so.6 => /AATest/lib64/libreadline.so.6 (0x00007f2c41324000)')
    print('        libtinfo.so.6 => /AATest/lib64/libtinfo.so.6 (0x00007f2c410f9000)')
    print('        libdl.so.2 => /AATest/lib64/libdl.so.2 (0x00007f2c40ef5000)')
    print('        libc.so.6 => /AATest/lib64/libc.so.6 (0x00007f2c40b50000)')
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x000055782c473000)')

elif sys.argv[1] == '/AATest/lib64/ld-2.22.so':
    print('        linux-vdso.so.1 (0x00007ffcf97f4000)')

elif sys.argv[1] == '/AATest/lib64/libc-2.22.so':
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x0000556858473000)')
    print('        linux-vdso.so.1 (0x00007ffe98912000)')

elif sys.argv[1] == '/AATest/lib64/libdl.so.2':
    print('        linux-vdso.so.1 (0x00007ffec2538000)')
    print('        libc.so.6 => /AATest/lib64/libc.so.6 (0x00007f8865346000)')
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x0000560c3bcee000)')

elif sys.argv[1] == '/AATest/lib64/libtinfo.so.6':
    print('        linux-vdso.so.1 (0x00007fff30518000)')
    print('        libc.so.6 => /AATest/lib64/libc.so.6 (0x00007fb6f2ea3000)')
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x00005631fe8d3000)')

elif sys.argv[1] == '/AATest/lib64/libreadline.so.6':
    print('        linux-vdso.so.1 (0x00007ffcb5b62000)')
    print('        libtinfo.so.6 => /AATest/lib64/libtinfo.so.6 (0x00007f2a4ed07000)')
    print('        libc.so.6 => /AATest/lib64/libc.so.6 (0x00007f2a4e961000)')
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x000055f749c89000)')

elif sys.argv[1] == '/AATest/lib64/ld-linux-x86-64.so.2':
    print('        statically linked')

elif sys.argv[1] == '/AATest/lib64/libc.so.6':
    print('        /AATest/lib64/ld-linux-x86-64.so.2 (0x000055b65f7a9000)')
    print('        linux-vdso.so.1 (0x00007ffde132b000)')


elif sys.argv[1] == '/AATest/sbin/ldconfig':
    print('        not a dynamic executable')
    sys.exit(1)  # ldd exits with $? == 1 in this case

elif sys.argv[1].startswith('/tmp/aa-test-'):  # test file generated by test-aa.py
    print('        not a dynamic executable')

elif sys.argv[1] == 'TEMPLATE':
    print('')
    print('')
    print('')

else:
    raise Exception('unknown parameter in fake_ldd: %s' % sys.argv[1])