DennyDai / headless-ida

Run IDA scripts headlessly.

Home Page:https://pypi.org/project/headless-ida/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is there a way to load idb file

weituotian opened this issue · comments

so it does not have to reanalyisis every time

headless-ida should already support loading IDB files. You can load them the same way you would load a normal binary. Please let me know if you encounter any issues or if it doesn't work as expected.

when i try to load i64 database file, it says

Exception: IDA failed to start: return code 4
Command: "D:\Program Files\IDA_Pro_7.7_Portable\ida64.exe" -A -S"D:\capstone_test2\venv\Lib\site-packages\headless_ida\ida_script.py 57816" -P+ "J:\temp\tmpn5sduy89.i64"

@weituotian I've tried running it locally with an i64 file of /bin/ls, and it works for me. Could you send over the i64 file you have if possible? Alternatively, could you run the command returned by headless-ida but remove the -A flag, and paste the error output here?

"D:\Program Files\IDA_Pro_7.7_Portable\ida64.exe" -S"D:\capstone_test2\venv\Lib\site-packages\headless_ida\ida_script.py 57816" -P+ "/path/to/i64/file"

yes, here is the example bin and i64 file:
example.zip

when i delete -A in source
image

it shows
image

but i check the file is exists J:\\temp\\tmpor738i2h.i64

@weituotian I tried to load the i64 file you provided, and it works perfectly for me on Linux. Based on what you've shown, I believe the issue is more likely related to the temporary file. If the file exists, can you try loading the temp file directly using ida64 and see if that works? If it doesn't, you'll probably want to debug the issue by checking file permissions and other potential causes.

when i drag the tmp file from file explorer, it also get the "could not open" tips
when i move the tmp file to other dir, and drag it to ida, it works!
may be a behavior in ida in win10.

and I try comment binary_path = tempidb.name
image
it works also.

it seem -A flag will cause IDA failed to start: return code 4 in windows, and tmp file not work with ida7.7 in windows

It appears that the issue is related to your system setup and is not directly caused by IDA or headless-ida. When loading an IDB/I64 file, headless-ida creates a temporary copy of the file and loads it from there to prevent accidentally overwriting the original IDB file. It uses tempfile.NamedTemporaryFile(suffix=".i64") to achieve this.

The fact that it defaults to J:\temp instead of C:\temp and that J:\temp doesn't work in your case suggests that there might be an issue with the temporary file creation or permissions on your system.

As this seems to be specific to your system configuration, you will need to investigate and resolve the issue on your end.