Пример #1
0
    def do_permissions(args):

        """
        Description: List enumeration and api mappings from target APK

        Requirements: Loaded APK

        Usage: permissions <list> || <map>
        """

        try:
            from framework.brains.apk.enumeration.permissions import PermissionsList, PermissionsMap
            if args == "list":
                if globals()["apk"] is not None:
                    p = PermissionsList(globals()["apk"])
                    p.run_list_permissions()
                else:
                    print(t.red("[{0}] ".format(datetime.now())) +
                          t.white("Module not available"))
                    print(t.red("[{0}] ".format(datetime.now())) +
                          t.white("You cannot list permissions with out a loaded APK"))
            if args == "map":
                if globals()["apk"] is not None and globals()["apks"] is not None:
                    p = PermissionsMap(globals()["apk"], globals()["apks"])
                    p.run_map_permissions()
                else:
                    print(t.red("[{0}] ".format(datetime.now())) +
                          t.white("Module not available"))
                    print(t.red("[{0}] ".format(datetime.now())) +
                          t.white("You cannot map permissions with out an executable or APK"))
        except ImportError as e:
            print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Permissions"))
            Logger.run_logger(e.message)
Пример #2
0
    def do_permissions(args):
        """
        Description: List enumeration and api mappings from target APK

        Requirements: Loaded APK

        Usage: permissions <list> || <map>
        """
        try:
            from framework.brains.apk.enumeration.permissions import PermissionsList, PermissionsMap
            if args:
                if args == "list":
                    if globals()["apk"] is not None:
                        # Instantiate permissions
                        # module
                        #
                        p = PermissionsList(globals()["apk"])
                        p.run_list_permissions()
                    else:
                        print(
                            t.red("[{0}] ".format(datetime.now())) +
                            t.white(enum.MODULE_UNAVAILABLE))
                        print(
                            t.red("[{0}] ".format(datetime.now())) +
                            t.white(enum.PERMISSIONS_LIST_MODULE_MESSAGE))
                if args == "map":
                    if globals()["apk"] is not None and globals(
                    )["apks"] is not None:
                        # Instantiate permissions
                        # module
                        p = PermissionsMap(globals()["apk"], globals()["apks"])
                        p.run_map_permissions()
                    else:
                        print(
                            t.red("[{0}] ".format(datetime.now())) +
                            t.white(enum.MODULE_UNAVAILABLE))
                        print(
                            t.red("[{0}] ".format(datetime.now())) +
                            t.white(enum.PERMISSIONS_MAP_MODULE_MESSAGE))
            else:
                print(
                    t.red("[{0}] ".format(datetime.now()) +
                          t.white(enum.ARGUMENTS)))
        except Exception as e:
            if e.message == enum.STRING_INDEX_ERROR or e.message == enum.LIST_INDEX_ERROR:
                print(
                    t.red("[{0}] ".format(datetime.now()) +
                          t.white(enum.ARGUMENTS)))
                print(
                    t.red("[{0}] ".format(datetime.now()) +
                          t.white(enum.DECOMPILE_USAGE)))
        except ImportError as e:
            print(
                t.red("[{0}] ".format(datetime.now()) +
                      enum.IMPORT_ERROR_PERMISSIONS))
            Logger.run_logger(e.message)
Пример #3
0
    def do_permissions(args):
        """
        Description: List enumeration and api mappings from target APK

        Requirements: Loaded APK

        Usage: permissions <list> || <map>
        """
        try:
            from framework.brains.apk.enumeration.permissions import PermissionsList, PermissionsMap

            if args:
                if args == "list":
                    if globals()["apk"] is not None:
                        # Instantiate permissions
                        # module
                        #
                        p = PermissionsList(globals()["apk"])
                        p.run_list_permissions()
                    else:
                        print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.MODULE_UNAVAILABLE))
                        print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.PERMISSIONS_LIST_MODULE_MESSAGE))
                if args == "map":
                    if globals()["apk"] is not None and globals()["apks"] is not None:
                        # Instantiate permissions
                        # module
                        p = PermissionsMap(globals()["apk"], globals()["apks"])
                        p.run_map_permissions()
                    else:
                        print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.MODULE_UNAVAILABLE))
                        print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.PERMISSIONS_MAP_MODULE_MESSAGE))
            else:
                print(t.red("[{0}] ".format(datetime.now()) + t.white(enum.ARGUMENTS)))
        except Exception as e:
            if e.message == enum.STRING_INDEX_ERROR or e.message == enum.LIST_INDEX_ERROR:
                print(t.red("[{0}] ".format(datetime.now()) + t.white(enum.ARGUMENTS)))
                print(t.red("[{0}] ".format(datetime.now()) + t.white(enum.DECOMPILE_USAGE)))
        except ImportError as e:
            print(t.red("[{0}] ".format(datetime.now()) + enum.IMPORT_ERROR_PERMISSIONS))
            Logger.run_logger(e.message)