summaryrefslogtreecommitdiff
path: root/python/amanifest.py
blob: a076bc41b1996a493f345765e2f34780e28d911d (plain)
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
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import argparse
import pychrysalide
from pychrysalide.analysis.contents import FileContent
from pychrysalide.format.axml import AxmlFormat
from pychrysalide.format.axml import AndroidManifest


if __name__ == '__main__':

    parser = argparse.ArgumentParser(description='amanifest - Displays information about Android Manifests.', add_help=False)

    parser.add_argument('-H', '--help', action='store_true', help='Display the command line options.')

    parser.add_argument('file', type=str, help='The object file to be examined')

    args = parser.parse_args()

    if args.help:
        parser.print_help()
        sys.exit(1)

    cnt = FileContent(args.file)

    fmt = AxmlFormat(cnt)

    manifest = AndroidManifest(fmt)

    manifest.analyze_and_wait()

    #print(fmt.text)

    print()

    print('Min SDK:   ', manifest.min_sdk)
    print('Target SDK:', manifest.target_sdk)
    print('Max SDK:   ', manifest.max_sdk)
    print()

    print('Permissions:')
    for p in manifest.permissions:
        print(' - ', p)
    print()

    print('Activities:')
    for p in manifest.activities:
        print(' - ', p)
    print()

    print('Providers:')
    for p in manifest.providers:
        print(' - ', p)
    print()

    print('Receivers:')
    for p in manifest.receivers:
        print(' - ', p)
    print()

    print('Services:')
    for p in manifest.services:
        print(' - ', p)
    print()