diff --git a/I. Mach-O/python/MachOFileFinder.py b/I. Mach-O/python/MachOFileFinder.py index 8478895..15f3716 100755 --- a/I. Mach-O/python/MachOFileFinder.py +++ b/I. Mach-O/python/MachOFileFinder.py @@ -4,6 +4,7 @@ import sys import argparse import struct from concurrent.futures import ThreadPoolExecutor +import stat class MachOFileFinder: # Mach-O and FAT magic numbers @@ -37,6 +38,14 @@ class MachOFileFinder: self.recursive = recursive self.only_arm64 = only_arm64 + def isRegularFile(self, file_path): + """Check if the specified file is a regular file.""" + try: + return stat.S_ISREG(os.stat(file_path).st_mode) + except (OSError, IOError) as e: + # print(f"Error checking file type for {file_path}: {e}") + return False + def determineFileEndianness(self, magic): """Determine the endianness of the file based on the magic number.""" if magic in (self.MACHO_CIGAM, self.MACHO_CIGAM_64, self.FAT_CIGAM): @@ -161,6 +170,11 @@ class MachOFileFinder: for file_name in files: file_path = os.path.abspath(os.path.join(root, file_name)) + # Check if the file is a regular file before processing + if not self.isRegularFile(file_path): + #print(f"Skipping non-regular file: {file_path}") + continue + # Check if the file is a Mach-O binary or FAT binary file_type = self.getMachoInfo(file_path) if file_type: diff --git a/README.md b/README.md index bc03053..3612ee3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The table of contents showing links to all articles is below: * ☑ [Apple UUID Finder](https://karol-mazurek.medium.com/apple-uuid-finder-a5173bdd1a8a?sk=v2%2F04bb0d32-6dc9-437d-bf72-8f65e03fed90) * ☐ [X. NU]() * ☑ [Kernel Debugging Setup on MacOS](https://karol-mazurek.medium.com/kernel-debugging-setup-on-macos-07dd8c86cdb6?sk=v2%2F782bf539-a057-4f14-bbe7-f8e1ace26701) - + * ☐ [Fixing an Infinite Loop]() ## TOOLS [CrimsonUroboros](#crimsonuroboros) • [MachOFileFinder](#machofilefinder) • [TrustCacheParser](#trustcacheparser) • [SignatureReader](#signaturereader) • [extract_cms.sh](#extract_cmssh) • [ModifyMachOFlags](#modifymachoflags) • [LCFinder](#lcfinder) • [MachODylibLoadCommandsFinder](#machodylibloadcommandsfinder) • [AMFI_test.sh](VI.%20AMFI/custom/AMFI_test.sh) • [make_plist](VIII.%20Sandbox/python/make_plist.py) • [sandbox_inspector](VIII.%20Sandbox/python/sandbox_inspector.py) • [spblp_compiler_wrapper](VIII.%20Sandbox/custom/sbpl_compiler_wrapper) • [make_bundle](#make_bundle) • [make_bundle_exe](#make_bundle_exe) • [make_dmg](#make_dmg) • [electron_patcher](#electron_patcher) • [sandbox_validator](#sandbox_validator) • [sandblaster](#sandblaster) • [sip_check](#sip_check) • [crimson_waccess.py](#crimson_waccesspy) • [sip_tester](#sip_tester) • [UUIDFinder](#uuidfinder)