From f27ab04549a87cdbe5829d67186ec38aa2d37166 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Wed, 11 May 2016 19:50:39 -0700 Subject: [PATCH] Add helper to determine dependency versions --- pwndbg/gitver.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pwndbg/gitver.py 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)