MCPcopy Create free account
hub / github.com/HexHive/NASS / do_invoke

Method do_invoke

tools/gef.py:6606–6629  ·  view source on GitHub ↗
(self, _: List[str], **kwargs: Any)

Source from the content-addressed store, hash-verified

6604
6605 @parse_arguments({"symbol": ""}, {})
6606 def do_invoke(self, _: List[str], **kwargs: Any) -> None:
6607 def hex_to_int(num):
6608 try:
6609 return int(num, 16)
6610 except ValueError:
6611 return 0
6612 args : argparse.Namespace = kwargs["arguments"]
6613 if not args.symbol:
6614 self.usage()
6615 return
6616 sym = args.symbol
6617 with open("/proc/kallsyms", "r") as f:
6618 syms = [line.strip().split(" ", 2) for line in f]
6619 matches = [(hex_to_int(addr), sym_t, " ".join(name.split())) for addr, sym_t, name in syms if sym in name]
6620 for addr, sym_t, name in matches:
6621 if sym == name.split()[0]:
6622 ok(f"Found matching symbol for '{name}' at {addr:#x} (type={sym_t})")
6623 else:
6624 warn(f"Found partial match for '{sym}' at {addr:#x} (type={sym_t}): {name}")
6625 if not matches:
6626 err(f"No match for '{sym}'")
6627 elif matches[0][0] == 0:
6628 err("Check that you have the correct permissions to view kernel symbol addresses")
6629 return
6630
6631
6632@register

Callers

nothing calls this directly

Calls 5

warnFunction · 0.85
errFunction · 0.85
usageMethod · 0.80
joinMethod · 0.80
okFunction · 0.70

Tested by

no test coverage detected