mirror of https://github.com/geohot/qira
loader fails nicely on non-ELF inputs
This commit is contained in:
parent
e3faa3e32c
commit
bb1c57746b
|
@ -1,6 +1,7 @@
|
||||||
from elftools.elf.elffile import ELFFile
|
from elftools.elf.elffile import ELFFile
|
||||||
from elftools.elf.sections import SymbolTableSection
|
from elftools.elf.sections import SymbolTableSection
|
||||||
from elftools.elf.relocation import RelocationSection
|
from elftools.elf.relocation import RelocationSection
|
||||||
|
from elftools.common.exceptions import ELFError
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
def get_arch(fb):
|
def get_arch(fb):
|
||||||
|
@ -19,7 +20,11 @@ def get_arch(fb):
|
||||||
|
|
||||||
|
|
||||||
def load_binary(static):
|
def load_binary(static):
|
||||||
elf = ELFFile(open(static.path))
|
try:
|
||||||
|
elf = ELFFile(open(static.path))
|
||||||
|
except ELFError:
|
||||||
|
print "*** loader error: non-ELF detected"
|
||||||
|
return
|
||||||
|
|
||||||
# TODO: replace with elf['e_machine']
|
# TODO: replace with elf['e_machine']
|
||||||
progdat = open(static.path).read(0x20)
|
progdat = open(static.path).read(0x20)
|
||||||
|
|
Loading…
Reference in New Issue