Skip to content

Commit

Permalink
update default prompt to see which mode gef runs under
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Feb 4, 2024
1 parent bb0dbb5 commit 9b9e30a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -10438,9 +10438,7 @@ def __gef_prompt__(current_prompt: Callable[[Callable], str]) -> str:
"""GEF custom prompt function."""
if gef.config["gef.readline_compat"] is True: return GEF_PROMPT
if gef.config["gef.disable_color"] is True: return GEF_PROMPT
prompt = ""
if gef.session.remote:
prompt += Color.boldify("(remote) ")
prompt = gef.session.remote.mode.prompt_string() if gef.session.remote else ""
prompt += GEF_PROMPT_ON if is_alive() else GEF_PROMPT_OFF
return prompt

Expand Down Expand Up @@ -11095,6 +11093,15 @@ def __str__(self):
def __repr__(self):
return f"RemoteMode = {str(self)} ({int(self)})"

def prompt_string(self) -> str:
if self == GefRemoteSessionManager.RemoteMode.QEMU:
return Color.boldify("(qemu) ")
if self == GefRemoteSessionManager.RemoteMode.RR:
return Color.boldify("(rr) ")
if self == GefRemoteSessionManager.RemoteMode.GDBSERVER:
return Color.boldify("(remote) ")
raise AttributeError("Unknown value")

def __init__(self, host: str, port: int, pid: int =-1, qemu: Optional[pathlib.Path] = None) -> None:
super().__init__()
self.__host = host
Expand Down

0 comments on commit 9b9e30a

Please sign in to comment.