示例#1
0
    def execute(self, arguments):
        reload(sys)
        sys.setdefaultencoding('utf-8')

        shell = self.new("com.mwr.jdiesel.util.Shell")
	shell.write("su\n")
        """
        shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
	shell.write("logcat -d")
        shell.write("logcat -c")
        logs = read_shell(shell, 1)
        #self.stdout.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!LOGS before detecting is :\n%s\n" % logs)
        """

        if arguments.package != None:
            package = self.packageManager().getPackageInfo(arguments.package, PackageManager.GET_RECEIVERS | PackageManager.GET_PERMISSIONS)
            receivers = self.__get_receivers(package)

            count = 0
            broadcast_detect_result = {} #20160317
            self.stdout.write("broadcast detecting starts...\n")
            
            for receiver in receivers:
		shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
		logs = read_shell(shell, 1)
				
                count = count + 1
                self.stdout.write("  No.%d: %s\n" % (count, receiver.name))

                time.sleep(1)
                # Serializable added 20151113
                start_components = self.new("com.mwr.dz.apksec.StartComponents")
                try:
                    start_components.startcomponent(arguments.package, receiver.name, SEND_BROADCAST, self.getContext())
                except Exception as e:
                    pass

		shell.write("logcat -d")
                logs = read_shell(shell, 1)
                logs = cutoff_system_print(logs)
                broadcast_detect_result[receiver.name] = logs #20160317
                self.stdout.write("++++++++++++++++++++++++++++++++++++++++LOGS of %s++++++++++++++++++++++++++++++++++++++++\n%s\n" % (receiver.name, logs))
                self.stdout.flush()
                shell.write("logcat -c")
            
            #20160317    
            broadcast_detect_result = str(broadcast_detect_result)
            #self.stdout.write(broadcast_detect_result)
                
        else:
            self.stdout.write("package could not be None\n'")

        shell.close()
示例#2
0
文件: activity.py 项目: llfde/Drozer
    def execute(self, arguments):
        reload(sys)
        sys.setdefaultencoding("utf-8")

        shell = self.new("com.mwr.jdiesel.util.Shell")
        shell.write("su\n") # added 20160612
        """
        shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
        shell.write("logcat -d")#20160607
        shell.write("logcat -c")#20160612
        logs = read_shell(shell, 1)
        #self.stdout.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!logs before detecting is...\n%s\n" % logs)
        """

        if arguments.package != None:
            package = self.packageManager().getPackageInfo(arguments.package, PackageManager.GET_ACTIVITIES)
            activites = self.__get_activities(package)

            self.stdout.write("activity detecting starts...\n")
            activity_detect_result = {}#20160317
            count = 0
            for activity in activites:
                shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")#20160607
                logs = read_shell(shell, 1)#20160607

                count = count + 1
                self.stdout.write("  No.%d: %s\n" % (count, activity.name))

                time.sleep(1)
                # Serializable added 20151113 
                start_components = self.new("com.mwr.dz.apksec.StartComponents")
                try:
                    start_components.startcomponent(arguments.package, activity.name, START_ACTIVITY, self.getContext())
                except Exception as e:
                    pass

                shell.write("logcat -d")#20160607
                logs = read_shell(shell, 1)
                logs = cutoff_system_print(logs)
                activity_detect_result[activity.name] = logs#20160317
                self.stdout.write("++++++++++++++++++++++++++++++++++++++++LOGS of %s++++++++++++++++++++++++++++++++++++++++\n%s\n" % (activity.name, logs))
                self.stdout.flush() #added 20151116
                shell.write("logcat -c")#20160612
                
            #20160317    
            activity_detect_result = str(activity_detect_result)
            #self.stdout.write(activity_detect_result)
                
        else:
            self.stdout.write("package could not be None!\n")

        shell.close()
示例#3
0
    def execute(self, arguments):
        reload(sys)
        sys.setdefaultencoding('utf-8')

        shell = self.new("com.mwr.jdiesel.util.Shell")
        shell.write("su\n")
        shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
        shell.write("logcat -d")
        shell.write("logcat -c")
        logs = read_shell(shell, 1)
        #self.stdout.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!logs before detecting is...\n%s\n" % logs)

        if arguments.package != None:
            package = self.packageManager().getPackageInfo(arguments.package, PackageManager.GET_SERVICES | PackageManager.GET_PERMISSIONS)
            services = self.__get_services(package)

            count = 0
            service_detect_result = {} #20160317
            self.stdout.write("service detecting starts...\n")
            for service in services:
                shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
                logs = read_shell(shell, 1)        

                count = count + 1
                self.stdout.write("  service No.%d: %s\n" % (count, service.name))

                time.sleep(1)
                # Serializable added 20151113
                start_components = self.new("com.mwr.dz.apksec.StartComponents")
                start_components.startcomponent(arguments.package, service.name, START_SERVICE, self.getContext())

                shell.write("logcat -d")
                logs = read_shell(shell, 1)
                logs = cutoff_system_print(logs)
                service_detect_result[service.name] = logs #20160317
                self.stdout.write("+++++++++++++++++++++++++++++++++++++++++LOGS of %s++++++++++++++++++++++++++++++++++++++++\n%s\n" % (service.name, logs))
                self.stdout.flush()
                shell.write("logcat -c")
                
            #20160317
            service_detect_result = str(service_detect_result)
            #self.stdout.write(service_detect_result)
                
        else:
            self.stdout.write("package could not be None\n'")

        shell.close()
示例#4
0
    def execute(self, arguments):
        reload(sys)
        sys.setdefaultencoding("utf-8")

        shell = self.new("com.mwr.jdiesel.util.Shell")
        shell.write("su\n")  # added 20160612
        """
        shell.write("logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S")
        shell.write("logcat -d")#20160607
        shell.write("logcat -c")#20160612
        logs = read_shell(shell, 1)
        #self.stdout.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!logs before detecting is...\n%s\n" % logs)
        """

        if arguments.package != None:
            package = self.packageManager().getPackageInfo(
                arguments.package, PackageManager.GET_ACTIVITIES)
            activites = self.__get_activities(package)

            self.stdout.write("activity detecting starts...\n")
            activity_detect_result = {}  #20160317
            count = 0
            for activity in activites:
                shell.write(
                    "logcat ContextImplcheckPermission:E IntentExtra:E AndroidRuntime:E *:S"
                )  #20160607
                logs = read_shell(shell, 1)  #20160607

                count = count + 1
                self.stdout.write("  No.%d: %s\n" % (count, activity.name))

                time.sleep(1)
                # Serializable added 20151113
                start_components = self.new(
                    "com.mwr.dz.apksec.StartComponents")
                try:
                    start_components.startcomponent(arguments.package,
                                                    activity.name,
                                                    START_ACTIVITY,
                                                    self.getContext())
                except Exception as e:
                    pass

                shell.write("logcat -d")  #20160607
                logs = read_shell(shell, 1)
                logs = cutoff_system_print(logs)
                activity_detect_result[activity.name] = logs  #20160317
                self.stdout.write(
                    "++++++++++++++++++++++++++++++++++++++++LOGS of %s++++++++++++++++++++++++++++++++++++++++\n%s\n"
                    % (activity.name, logs))
                self.stdout.flush()  #added 20151116
                shell.write("logcat -c")  #20160612

            #20160317
            activity_detect_result = str(activity_detect_result)
            #self.stdout.write(activity_detect_result)

        else:
            self.stdout.write("package could not be None!\n")

        shell.close()