Skip to content

Instantly share code, notes, and snippets.

@itdaniher
Created January 3, 2018 15:08
Show Gist options
  • Save itdaniher/6a28da2edb51587ca41102b8d2c9ecbb to your computer and use it in GitHub Desktop.
Save itdaniher/6a28da2edb51587ca41102b8d2c9ecbb to your computer and use it in GitHub Desktop.
archid via elftools
try:
from elftools.elf.elffile import ELFFile
except:
ELFFile = None
if ELFFile is not None:
import sys
elf_file=open(sys.argv[1], 'rb')
machine = ELFFile(elf_file).get_machine_arch().lower()
print(machine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment