43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import subprocess
|
|
import time
|
|
|
|
def main():
|
|
|
|
# Задается вручную
|
|
bindiff_path = r"C:\tools\BinDiff\bin\bindiff.exe"
|
|
idb_dir = r"C:\tools\idb"
|
|
bindiff_exports_dir = r"C:\tools\export"
|
|
#
|
|
|
|
# Создание файлов экспорта, сравнение
|
|
start = time.perf_counter()
|
|
create_exports(bindiff_path, idb_dir, bindiff_exports_dir)
|
|
compare_exports(bindiff_path, bindiff_exports_dir)
|
|
#
|
|
|
|
# Подсчет времени
|
|
elapsed = time.perf_counter() - start
|
|
print(f"Elapsed: {elapsed}")
|
|
#
|
|
|
|
def create_exports(bindiff_path, idb_dir, bindiff_exports_dir):
|
|
cmd = f"{bindiff_path} --export {idb_dir} --output_dir {bindiff_exports_dir}"
|
|
print('Creating export files...', end=' ')
|
|
try:
|
|
subprocess.run(cmd, capture_output=True, check=True)
|
|
print('\033[92mSuccess!\033[0m')
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"\033[91mError during export: {e}\033[0m")
|
|
|
|
def compare_exports(bindiff_path, bindiff_exports_dir):
|
|
cmd = f"{bindiff_path} {bindiff_exports_dir} --output_format log"
|
|
print('Comparing...', end=' ')
|
|
try:
|
|
subprocess.run(cmd, capture_output=True, check=True)
|
|
print('\033[92mSuccess!\033[0m')
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"\033[91mError during comparing: {e}\033[0m")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|