<commit_before>from framework.logging.logger import Logger
from subprocess import Popen, CalledProcessError
from datetime import datetime
from blessings import Terminal
t = Terminal()


class Decompile(object):
    def __init__(self, directory, apk):

        super(Decompile, self).__init__()

        self.apk = apk
        self.directory = directory

    def do_decompile(self):

        """
        Decompile target APK with apktool
        """

        print(t.green("[{0}] ".format(datetime.now())) +
              t.yellow("Decompiling : ") +
              self.apk)

        try:

            Popen("java -jar apktool.jar d {0} -f -o output/{1}".format(self.apk, self.directory),
                  shell=True).wait()

            print(t.green("[{0}] ".format(datetime.now())) +
                  t.yellow("Finished!"))

        except CalledProcessError as e:
            print(t.red("[{0}] ".format(datetime.now)) + e.returncode)
            Logger.do_logger(e.message)<commit_msg>Update decompile.py<commit_after>from framework.logging.logger import Logger
from subprocess import Popen, CalledProcessError
from datetime import datetime
from blessings import Terminal
t = Terminal()


class Decompile(object):
    def __init__(self, directory, apk):

        super(Decompile, self).__init__()

        self.apk = apk
        self.directory = directory

    def do_decompile(self):

        """
        Decompile target APK with apktool
        """

        print(t.green("[{0}] ".format(datetime.now())) +
              t.yellow("Decompiling : ") +
              self.apk)

        try:
            Popen("java -jar apktool.jar d {0} -f -o output/{1}".format(self.apk, self.directory),
                  shell=True).wait()

            print(t.green("[{0}] ".format(datetime.now())) +
                  t.yellow("Finished!"))

        except CalledProcessError as e:
            print(t.red("[{0}] ".format(datetime.now)) + e.returncode)
            Logger.do_logger(e.message)

{'fraction_non_alphanumeric': 0.13430583501006035, 'fraction_numerical': 0.005030181086519115, 'mean_word_length': 2.234146341463415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3608019', 'n_tokens_mistral': 603, 'n_tokens_neox': 558, 'n_words': 128}