default=False,
                        help="Print androguard version and exit")

    parser.add_argument(
        "--input",
        "-i",
        help="AndroidManifest.xml or APK to parse (legacy option)")
    parser.add_argument("file",
                        nargs="?",
                        help="AndroidManifest.xml or APK to parse")
    args = parser.parse_args()

    if args.file and args.input:
        print(
            "Can not give --input and positional argument! Please use only one of them!"
        )
        sys.exit(1)

    if args.version:
        print("Androaxml version %s" % androconf.ANDROGUARD_VERSION)
        sys.exit(0)

    if not args.input and not args.file:
        print("Give one file to decode!")
        sys.exit(1)

    if args.file:
        main(args.file, args.output)
    elif args.input:
        main(args.input, args.output)
Beispiel #2
0
        arscobj = a.get_android_resources()
    elif ret_type == "ARSC":
        arscobj = apk.ARSCParser(read(fname))
    else:
        print("Unknown file type!", file=sys.stderr)
        sys.exit(1)

    if args.list_packages:
        print("\n".join(arscobj.get_packages_names()))
        sys.exit(0)

    if args.list_locales:
        for p in arscobj.get_packages_names():
            print("In Package:", p)
            print("\n".join(map(lambda x: "  \\x00\\x00" if x == "\x00\x00" else
                "  {}".format(x), sorted(arscobj.get_locales(p)))))
        sys.exit(0)

    if args.list_types:
        for p in arscobj.get_packages_names():
            print("In Package:", p)
            for locale in sorted(arscobj.get_locales(p)):
                print("  In Locale: {}".format("\\x00\\x00" if locale == "\x00\x00" else
                    locale))
                print("\n".join(map("    {}".format, sorted(arscobj.get_types(p,
                    locale)))))
        sys.exit(0)


    main(arscobj, outp=args.output, package=args.package, typ=args.type, locale=args.locale)
Beispiel #3
0
    parser.add_argument("--output", "-o",
            help="filename to save the decoded AndroidManifest.xml to")
    parser.add_argument("--version", "-v", action="store_true", default=False,
            help="Print androguard version and exit")

    parser.add_argument("--input", "-i",
            help="AndroidManifest.xml or APK to parse (legacy option)")
    parser.add_argument("file", nargs="?",
            help="AndroidManifest.xml or APK to parse")
    args = parser.parse_args()


    if args.file and args.input:
        print("Can not give --input and positional argument! Please use only one of them!")
        sys.exit(1)

    if args.version:
        print("Androaxml version %s" % androconf.ANDROGUARD_VERSION)
        sys.exit(0)

    if not args.input and not args.file:
        print("Give one file to decode!")
        sys.exit(1)

    if args.file:
        main(args.file, args.output)
    elif args.input:
        main(args.input, args.output)