diff --git a/pwndbg/gitver.py b/pwndbg/gitver.py new file mode 100644 index 000000000..81107d37b --- /dev/null +++ b/pwndbg/gitver.py @@ -0,0 +1,21 @@ +import os +import subprocess + +file_path = os.path.dirname(__file__) +pwndbg_pwndbg = os.path.abspath(file_path) +pwndbg = os.path.dirname(pwndbg_pwndbg) +capstone = os.path.join(pwndbg, 'capstone') +unicorn = os.path.join(pwndbg, 'unicorn') + +def get_hash(directory): + argv = ['git', '-C', directory, 'describe', '--always'] + return subprocess.check_output(argv).strip() + +hashes = { + 'capstone': get_hash(capstone), + 'unicorn': get_hash(unicorn), + 'pwndbg': get_hash(pwndbg) +} + +if __name__ == '__main__': + print(hashes)