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

Class GefSaveCommand

tools/gef.py:9704–9739  ·  view source on GitHub ↗

GEF save sub-command. Saves the current configuration of GEF to disk (by default in file '~/.gef.rc').

Source from the content-addressed store, hash-verified

9702
9703
9704class GefSaveCommand(gdb.Command):
9705 """GEF save sub-command.
9706 Saves the current configuration of GEF to disk (by default in file '~/.gef.rc')."""
9707 _cmdline_ = "gef save"
9708 _syntax_ = _cmdline_
9709
9710 def __init__(self) -> None:
9711 super().__init__(self._cmdline_, gdb.COMMAND_SUPPORT, gdb.COMPLETE_NONE, False)
9712 return
9713
9714 def invoke(self, args: Any, from_tty: bool) -> None:
9715 self.dont_repeat()
9716 cfg = configparser.RawConfigParser()
9717 old_sect = None
9718
9719 # save the configuration
9720 for key in sorted(gef.config):
9721 sect, optname = key.split(".", 1)
9722 value = gef.config[key]
9723
9724 if old_sect != sect:
9725 cfg.add_section(sect)
9726 old_sect = sect
9727
9728 cfg.set(sect, optname, value)
9729
9730 # save the aliases
9731 cfg.add_section("aliases")
9732 for alias in gef.session.aliases:
9733 cfg.set("aliases", alias._alias, alias._command)
9734
9735 with GEF_RC.open("w") as fd:
9736 cfg.write(fd)
9737
9738 ok(f"Configuration saved to '{GEF_RC}'")
9739 return
9740
9741
9742class GefRestoreCommand(gdb.Command):

Callers 1

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected