Skip to content

Commit

Permalink
Fixed elf-info
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Dec 14, 2021
1 parent 5b20f3c commit 87e6204
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gef.py
Expand Up @@ -6024,11 +6024,11 @@ def do_invoke(self, argv):
endian = get_endian()

if argc >= 2:
if argv[1].lower() == "big": endian = Elf.BIG_ENDIAN
elif argv[1].lower() == "little": endian = Elf.LITTLE_ENDIAN
if argv[1].lower() == "big": endian = Endianness.BIG_ENDIAN
elif argv[1].lower() == "little": endian = Endianness.LITTLE_ENDIAN

if is_hex(pattern):
if endian == Elf.BIG_ENDIAN:
if endian == Endianness.BIG_ENDIAN:
pattern = "".join(["\\x" + pattern[i:i + 2] for i in range(2, len(pattern), 2)])
else:
pattern = "".join(["\\x" + pattern[i:i + 2] for i in range(len(pattern) - 2, 0, -2)])
Expand Down Expand Up @@ -7854,8 +7854,8 @@ def do_invoke(self, argv, *args, **kwargs):
}

endianness = {
Elf.LITTLE_ENDIAN : "Little-Endian",
Elf.BIG_ENDIAN : "Big-Endian",
Endianness.LITTLE_ENDIAN : "Little-Endian",
Endianness.BIG_ENDIAN : "Big-Endian",
}

osabi = {
Expand Down Expand Up @@ -7902,7 +7902,7 @@ def do_invoke(self, argv, *args, **kwargs):
data = [
("Magic", "{0!s}".format(hexdump(struct.pack(">I", elf.e_magic), show_raw=True))),
("Class", "{0:#x} - {1}".format(elf.e_class, classes[elf.e_class])),
("Endianness", "{0:#x} - {1}".format(elf.e_endianness, endianness[elf.e_endianness])),
("Endianness", "{0:#x} - {1}".format(elf.e_endianness, Endianness(elf.e_endianness).name)),
("Version", "{:#x}".format(elf.e_eiversion)),
("OS ABI", "{0:#x} - {1}".format(elf.e_osabi, osabi[elf.e_osabi])),
("ABI Version", "{:#x}".format(elf.e_abiversion)),
Expand Down Expand Up @@ -10640,7 +10640,7 @@ def is_loaded(x):

if initial:
gef_print("{:s} for {:s} ready, type `{:s}' to start, `{:s}' to configure"
.format(Color.greenify("GEF"), get_os(),
.format(Color.greenify("GEF"), gef.session.os,
Color.colorify("gef", "underline yellow"),
Color.colorify("gef config", "underline pink")))

Expand Down

0 comments on commit 87e6204

Please sign in to comment.