| 10084 | |
| 10085 | |
| 10086 | def __install_extras_script(self, script: str) -> bool: |
| 10087 | fpath = self.dirpath / f"{script}.py" |
| 10088 | if not fpath.exists(): |
| 10089 | url = f"https://raw.githubusercontent.com/hugsy/gef-extras/{self.branch}/scripts/{script}.py" |
| 10090 | info(f"Searching for '{script}.py' in `gef-extras@{self.branch}`...") |
| 10091 | data = http_get(url) |
| 10092 | if not data: |
| 10093 | warn("Not found") |
| 10094 | return False |
| 10095 | |
| 10096 | with fpath.open("wb") as fd: |
| 10097 | fd.write(data) |
| 10098 | fd.flush() |
| 10099 | |
| 10100 | old_command_set = set(gef.gdb.commands) |
| 10101 | gdb.execute(f"source {fpath}") |
| 10102 | new_command_set = set(gef.gdb.commands) |
| 10103 | new_commands = [f"`{c[0]}`" for c in (new_command_set - old_command_set)] |
| 10104 | ok(f"Installed file '{fpath}', new command(s) available: {', '.join(new_commands)}") |
| 10105 | return True |
| 10106 | |
| 10107 | |
| 10108 | # |