def __init__(self,
                 vm,
                 bin_dex2jar="dex2jar.sh",
                 bin_fernflower="fernflower.jar",
                 options_fernflower={"dgs": '1',
                                     "asc": '1'},
                 tmp_dir="/tmp/"):
        """
        Decompiler interface for Fernflower
        Fernflower is a java decompiler by IntelliJ:
        https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine

        As it can not decompile Dalvik code directly, the DEX is first
        decompiled as a JAR file.

        .. deprecated:: 3.3.5
            Fernflower is not supported anymore by androguard.


        :param vm: `DalvikVMFormtat` object
        :param bin_dex2jar:
        :param bin_fernflower:
        :param options_fernflower:
        :param tmp_dir:
        """
        warnings.warn("Fernflower is deprecated since 3.3.5.", DeprecationWarning)

        self.classes = {}
        self.classes_failed = []

        pathtmp = tmp_dir
        if not os.path.exists(pathtmp):
            os.makedirs(pathtmp)

        fd, fdname = tempfile.mkstemp(dir=pathtmp)
        with os.fdopen(fd, "w+b") as fd:
            fd.write(vm.get_buff())
            fd.flush()

        cmd = Popen([bin_dex2jar, fdname],
                        stdout=PIPE,
                        stderr=STDOUT)
        stdout, stderr = cmd.communicate()
        os.unlink(fdname)

        pathclasses = fdname + "dex2jar/"
        cmd = Popen(["unzip", fdname + "_dex2jar.jar", "-d", pathclasses],
                        stdout=PIPE,
                        stderr=STDOUT)
        stdout, stderr = cmd.communicate()
        os.unlink(fdname + "_dex2jar.jar")

        for root, dirs, files in os.walk(pathclasses, followlinks=True):
            if files:
                for f in files:
                    real_filename = root
                    if real_filename[-1] != "/":
                        real_filename += "/"
                    real_filename += f

                    l = ["java", "-jar", bin_fernflower]

                    for option in options_fernflower:
                        l.append("-%s:%s" %
                                 (option, options_fernflower[option]))
                    l.append(real_filename)
                    l.append(root)

                    cmd = Popen(l, stdout=PIPE, stderr=STDOUT)
                    stdout, stderr = cmd.communicate()

        for i in vm.get_classes():
            fname = pathclasses + "/" + i.get_name()[1:-1] + ".java"
            if os.path.isfile(fname):
                self.classes[i.get_name()] = read(fname, binary=False)
            else:
                self.classes_failed.append(i.get_name())

        rrmdir(pathclasses)
def __init__ ( self , vm , bin_dex2jar = "dex2jar.sh" , bin_fernflower = "fernflower.jar" , options_fernflower = { "dgs" : '1' , "asc" : '1' } , tmp_dir = "/tmp/" ) : warnings . warn ( "Fernflower is deprecated since 3.3.5." , DeprecationWarning ) self . classes = { } self . classes_failed = [ ] pathtmp = tmp_dir if not os . path . exists ( pathtmp ) : os . makedirs ( pathtmp ) fd , fdname = tempfile . mkstemp ( dir = pathtmp ) with os . fdopen ( fd , "w+b" ) as fd : fd . write ( vm . get_buff ( ) ) fd . flush ( ) cmd = Popen ( [ bin_dex2jar , fdname ] , stdout = PIPE , stderr = STDOUT ) stdout , stderr = cmd . communicate ( ) os . unlink ( fdname ) pathclasses = fdname + "dex2jar/" cmd = Popen ( [ "unzip" , fdname + "_dex2jar.jar" , "-d" , pathclasses ] , stdout = PIPE , stderr = STDOUT ) stdout , stderr = cmd . communicate ( ) os . unlink ( fdname + "_dex2jar.jar" ) for root , dirs , files in os . walk ( pathclasses , followlinks = True ) : if files : for f in files : real_filename = root if real_filename [ - 1 ] != "/" : real_filename += "/" real_filename += f l = [ "java" , "-jar" , bin_fernflower ] for option in options_fernflower : l . append ( "-%s:%s" % ( option , options_fernflower [ option ] ) ) l . append ( real_filename ) l . append ( root ) cmd = Popen ( l , stdout = PIPE , stderr = STDOUT ) stdout , stderr = cmd . communicate ( ) for i in vm . get_classes ( ) : fname = pathclasses + "/" + i . get_name ( ) [ 1 : - 1 ] + ".java" if os . path . isfile ( fname ) : self . classes [ i . get_name ( ) ] = read ( fname , binary = False ) else : self . classes_failed . append ( i . get_name ( ) ) rrmdir ( pathclasses )
Decompiler interface for Fernflower
        Fernflower is a java decompiler by IntelliJ:
        https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine

        As it can not decompile Dalvik code directly, the DEX is first
        decompiled as a JAR file.

        .. deprecated:: 3.3.5
            Fernflower is not supported anymore by androguard.


        :param vm: `DalvikVMFormtat` object
        :param bin_dex2jar:
        :param bin_fernflower:
        :param options_fernflower:
        :param tmp_dir: