def return_app_bundle(self):
     plist_hunt = os.path.join(self.root_directory + '/*.app')
     for i in glob.glob(plist_hunt):
         YDConsole.single_label_and_value('Found app bundle name',
                                          os.path.basename(i))
         return i
     YDErrorHandling.exit_on_usage('no app bundle name found')
    def list_frameworks(self):
        for i in self.directory_extensions:
            YDConsole.banner('Looking for: ' + i)
            for root, dirs, files in os.walk(self.root_directory):
                for d in dirs:
                    if d.endswith(i):
                        YDConsole.single_value_subheading(d)

        return None
Exemplo n.º 3
0
def CheckBinary(executable_fp: str):
    YDConsole.banner("Radare 2 summary")
    r2 = r2pipe.open(executable_fp)
    check_list = ['stripped', 'bits', 'canary']

    for x in check_list:
        a = "iIj~{%s}" % (x)
        b = Thing(x, r2.cmd(a))
        YDConsole.single_value(b)

    r2.quit()
    def list_files(self):

        extension_final = self.file_extensions_light
        if self.log_level == YDDepth.HEAVY:
            extension_final = self.file_extensions_light + self.file_extensions_deep

        for i in extension_final:
            YDConsole.banner('Looking for: ' + i)
            for root, dirs, files in os.walk(self.root_directory):
                for f in files:
                    if f.endswith(i):
                        YDConsole.single_value_subheading(os.path.join(
                            root, f))
        return None
    def inspect_info_plist(self):
        target_infoplist = self.app_bundle_dir + '/Info.plist'
        if os.path.isfile(target_infoplist) == True:
            YDConsole.banner('Searching: ' + target_infoplist)

        try:
            import plistlib
        except ImportError:
            return None

        with open(target_infoplist, 'rb') as f:
            pl = plistlib.load(f)

        temp_permission_dict, temp_settings_dict, temp_wildcards_dict = {}, {}, {
        }  # avoid mix up of data when printing

        for key, value in pl.items():

            if key in self.general_settings:
                temp_settings_dict[key] = value
                if key == 'CFBundleExecutable':
                    self.exec_path = os.path.join(self.app_bundle_dir + '/' +
                                                  value)
                    YDConsole.single_value_subheading(
                        f'found exec file: {value}')

            if key.startswith('NS'):
                temp_permission_dict[key] = value

            for i in self.wildcard_searches:
                if i.lower() in key.lower():
                    temp_wildcards_dict[key] = value

        if len(temp_settings_dict) > 0:
            self.print_dict_from_plist('settings', temp_settings_dict)

        if len(temp_permission_dict) > 0:
            self.print_dict_from_plist('user permissions',
                                       temp_permission_dict)
        else:
            YDConsole.single_label_and_value('user permissions', 'none found')

        if len(temp_wildcards_dict) > 0:
            self.print_dict_from_plist('wildcards in plist',
                                       temp_wildcards_dict)
        return None
#!/usr/bin/env python

from yd_console import YDConsole
from yd_radare2 import CheckBinary
from yd_file_ext_search import YDFileExtensionSearch, YDDepth
from yd_start_helper import YDStartUpParameters
from yd_version import YDVersion
from yd_jtool import YDjtool

if __name__ == '__main__':
    YDConsole.banner('script started')
    YDConsole.single_value_subheading(YDVersion.string())
    b = YDStartUpParameters()
    YDConsole.single_value_subheading('Script executing ' + b.main_file)
    YDConsole.single_value_subheading('Path ' + b.path)
    a = YDFileExtensionSearch(b.path, YDDepth.LIGHT)
    #    CheckBinary(a.exec_path)

    c = YDjtool()
Exemplo n.º 7
0
 def exit_on_usage(self):
     YDConsole.single_label_and_value('Exiting', f'Check usage \n\t\t[+] {os.path.basename(main.__file__)} [filepath]')
     sys.exit(1)
Exemplo n.º 8
0
 def exit_on_usage ( arg1: str ):
     YDConsole.single_label_and_value('Exiting', f'\n\t\t[+] {arg1}')
     sys.exit(1)
    def print_dict_from_plist(self, title: str, findings: dict):
        YDConsole.banner(title)
        for k, v in findings.items():
            YDConsole.single_label_and_value(k, v)

        return None