| 4589 | _example_ = f"{_cmdline_}" |
| 4590 | |
| 4591 | def do_invoke(self, argv: List[str]) -> None: |
| 4592 | gef_fpath = pathlib.Path(inspect.stack()[0][1]).expanduser().absolute() |
| 4593 | gef_dir = gef_fpath.parent |
| 4594 | with gef_fpath.open("rb") as f: |
| 4595 | gef_hash = hashlib.sha256(f.read()).hexdigest() |
| 4596 | |
| 4597 | if os.access(f"{gef_dir}/.git", os.X_OK): |
| 4598 | ver = subprocess.check_output("git log --format='%H' -n 1 HEAD", cwd=gef_dir, shell=True).decode("utf8").strip() |
| 4599 | extra = "dirty" if len(subprocess.check_output("git ls-files -m", cwd=gef_dir, shell=True).decode("utf8").strip()) else "clean" |
| 4600 | gef_print(f"GEF: rev:{ver} (Git - {extra})") |
| 4601 | else: |
| 4602 | gef_blob_hash = subprocess.check_output(f"git hash-object {gef_fpath}", shell=True).decode().strip() |
| 4603 | gef_print("GEF: (Standalone)") |
| 4604 | gef_print(f"Blob Hash({gef_fpath}): {gef_blob_hash}") |
| 4605 | gef_print(f"SHA256({gef_fpath}): {gef_hash}") |
| 4606 | gef_print(f"GDB: {gdb.VERSION}") |
| 4607 | py_ver = f"{sys.version_info.major:d}.{sys.version_info.minor:d}" |
| 4608 | gef_print(f"GDB-Python: {py_ver}") |
| 4609 | |
| 4610 | if "full" in argv: |
| 4611 | gef_print(f"Loaded commands: {', '.join(gef.gdb.loaded_command_names)}") |
| 4612 | return |
| 4613 | |
| 4614 | |
| 4615 | @register |