commit 0f36daba75eeb9655c773aec0fe73958b034cfd7 Author: serr Date: Mon Mar 17 17:37:24 2025 +0300 new diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66dfad4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +venv +*.xlsx \ No newline at end of file diff --git a/comp.py b/comp.py new file mode 100644 index 0000000..1279a5a --- /dev/null +++ b/comp.py @@ -0,0 +1,42 @@ +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() diff --git a/exetoi64.py b/exetoi64.py new file mode 100644 index 0000000..bb4a3f2 --- /dev/null +++ b/exetoi64.py @@ -0,0 +1,24 @@ +import os +import subprocess + +def make_i64(ida_executable, infile, idbfile): + if os.path.isfile(idbfile): + print("\033[31mSkipping existing IDB %s. Analysis has already been made\033[0m" % idbfile) + return + + print(f"\033[92mAnalysing {infile}...\033[0m") + + cmd = [ida_executable, "-B", infile] + + process = subprocess.Popen(cmd, shell=True) + process.wait() + # там почему то создается ненужный asm файл + os.remove(infile+'.asm') + +if __name__ == "__main__": + + ida_executable = r"C:\Users\user\Desktop\IDA Pro 7.7.220118 (Windows) (x86,x64,ARM64)\ida64.exe" + exe_file = r"C:\tools\ilya.exe" + i64path = exe_file + ".i64" + + make_i64(ida_executable, exe_file, i64path) \ No newline at end of file