Check if a file starts with ELF magic bytes.
(filepath)
| 825 | |
| 826 | |
| 827 | def is_elf_using_magic(filepath): |
| 828 | """Check if a file starts with ELF magic bytes.""" |
| 829 | try: |
| 830 | with open(filepath, "rb") as f: |
| 831 | magic = f.read(4) |
| 832 | return magic == b'\x7FELF' |
| 833 | except Exception as e: |
| 834 | prRed(f"Error reading file: {e}") |
| 835 | return False |
| 836 | |
| 837 | |
| 838 | def check_with_file_command(filepath): |