Example #1
0
File: auto.py Project: wcx/DFFA
        def worker(idx, q):
            debug("Running worker-%d" % idx)

            while True:
                a, d, dx, axmlobj, arscobj = None, None, None, None, None
                try:
                    filename, fileraw = q.get()
                    id_file = zlib.adler32(fileraw)

                    debug("(worker-%d) get %s %d" % (idx, filename, id_file))

                    log = self.settings["log"](id_file, filename)

                    is_analysis_dex, is_analysis_adex = True, True
                    debug("(worker-%d) filtering file %d" % (idx, id_file))
                    filter_file_ret, filter_file_type = myandro.filter_file(
                        log, fileraw)
                    if filter_file_ret:
                        debug("(worker-%d) analysis %s" %
                              (id_file, filter_file_type))

                        if filter_file_type == "APK":
                            a = myandro.create_apk(log, fileraw)
                            is_analysis_dex = myandro.analysis_apk(log, a)
                            fileraw = a.get_dex()
                            filter_file_type = androconf.is_android_raw(
                                fileraw)

                        elif filter_file_type == "AXML":
                            axmlobj = myandro.create_axml(log, fileraw)
                            myandro.analysis_axml(log, axmlobj)

                        elif filter_file_type == "ARSC":
                            arscobj = myandro.create_arsc(log, fileraw)
                            myandro.analysis_arsc(log, arscobj)

                        if is_analysis_dex and filter_file_type == "DEX":
                            d = myandro.create_dex(log, fileraw)
                            is_analysis_adex = myandro.analysis_dex(log, d)

                        elif is_analysis_dex and filter_file_type == "DEY":
                            d = myandro.create_dey(log, fileraw)
                            is_analysis_adex = myandro.analysis_dey(log, d)

                        if is_analysis_adex and d:
                            dx = myandro.create_adex(log, d)
                            myandro.analysis_adex(log, dx)

                        myandro.analysis_app(log, a, d, dx)

                    myandro.finish(log)
                except Exception, why:
                    myandro.crash(log, why)
                    myandro.finish(log)

                del a, d, dx, axmlobj, arscobj
                q.task_done()
Example #2
0
File: auto.py Project: wcx/DFFA
        def worker(idx, q):
            debug("Running worker-%d" % idx)

            while True:
                a, d, dx, axmlobj, arscobj = None, None, None, None, None
                try:
                    filename, fileraw = q.get()
                    id_file = zlib.adler32(fileraw)

                    debug("(worker-%d) get %s %d" % (idx, filename, id_file))

                    log = self.settings["log"](id_file, filename)

                    is_analysis_dex, is_analysis_adex = True, True
                    debug("(worker-%d) filtering file %d" % (idx, id_file))
                    filter_file_ret, filter_file_type = myandro.filter_file(
                        log, fileraw)
                    if filter_file_ret:
                        debug("(worker-%d) analysis %s" %
                              (id_file, filter_file_type))

                        if filter_file_type == "APK":
                            a = myandro.create_apk(log, fileraw)
                            is_analysis_dex = myandro.analysis_apk(log, a)
                            fileraw = a.get_dex()
                            filter_file_type = androconf.is_android_raw(fileraw)

                        elif filter_file_type == "AXML":
                            axmlobj = myandro.create_axml(log, fileraw)
                            myandro.analysis_axml(log, axmlobj)

                        elif filter_file_type == "ARSC":
                            arscobj = myandro.create_arsc(log, fileraw)
                            myandro.analysis_arsc(log, arscobj)

                        if is_analysis_dex and filter_file_type == "DEX":
                            d = myandro.create_dex(log, fileraw)
                            is_analysis_adex = myandro.analysis_dex(log, d)

                        elif is_analysis_dex and filter_file_type == "DEY":
                            d = myandro.create_dey(log, fileraw)
                            is_analysis_adex = myandro.analysis_dey(log, d)

                        if is_analysis_adex and d:
                            dx = myandro.create_adex(log, d)
                            myandro.analysis_adex(log, dx)

                        myandro.analysis_app(log, a, d, dx)

                    myandro.finish(log)
                except Exception, why:
                    myandro.crash(log, why)
                    myandro.finish(log)

                del a, d, dx, axmlobj, arscobj
                q.task_done()
Example #3
0
File: auto.py Project: wcx/DFFA
    def filter_file(self, log, fileraw):
        """
      This method is called in order to filer a specific app

      :param log: an object which corresponds to a unique app
      :param fileraw: the raw app (a string)

      :rtype: a set with 2 elements, the return value (boolean) if it is necessary to
      continue the analysis and the file type
    """
        file_type = androconf.is_android_raw(fileraw)
        if file_type == "APK" or file_type == "DEX" or file_type == "DEY" or file_type == "AXML" or file_type == "ARSC":
            if file_type == "APK":
                if androconf.is_valid_android_raw(fileraw):
                    return (True, "APK")
            else:
                return (True, file_type)
        return (False, None)
Example #4
0
File: auto.py Project: wcx/DFFA
    def filter_file(self, log, fileraw):
        """
      This method is called in order to filer a specific app

      :param log: an object which corresponds to a unique app
      :param fileraw: the raw app (a string)

      :rtype: a set with 2 elements, the return value (boolean) if it is necessary to
      continue the analysis and the file type
    """
        file_type = androconf.is_android_raw(fileraw)
        if file_type == "APK" or file_type == "DEX" or file_type == "DEY" or file_type == "AXML" or file_type == "ARSC":
            if file_type == "APK":
                if androconf.is_valid_android_raw(fileraw):
                    return (True, "APK")
            else:
                return (True, file_type)
        return (False, None)