development environment
IDA pro 7.7
The latest version of vscode
The python version is consistent with IDA's own python 3.8.10
install plugin
Download the address of the plugin warehouse: https://github.com/ioncodes/idacode release version
Install plugins to IDApath/plugins/
idacode ->setting.py is set as follows:
HOST = "127.0.0.1"
PORT = 7065
DEBUG_PORT = 7066
PYTHON = "D:\\Python3810\\python.exe" #这里选择python安装路径
LOGGING = True
Then the python version and path in vscode need to be consistent with the settings here
Click the python configuration in the lower right corner of vscode
Install plugin dependencies
python -m pip install --user debugpy tornado
Start IDA
View the log as follows, which means the startup is successful
================================================================================
[IDACode] Plugin version 0.3.0
[IDACode] Plugin loaded, use Edit -> Plugins -> IDACode to start the server
================================================================================
Click edit->plugins->IDAcode Tips:
[IDACode] Listening on 127.0.0.1:7065
The IDA server started successfully
VScode client starts
Download the IDAcode plugin
ctrl+shift+x input IDAcode to download
Configure IDApython syntax prompt
ctrl+shift+p and enter open user setting
Add json as follows:
"python.autoComplete.extraPaths": [
"D:\\IDA_Pro_7.7\\python\\3"
],
"python.analysis.extraPaths": [
"D:\\IDA_Pro_7.7\\python\\3"
],
Connect to IDA
ctrl+shift+p and enter IDA
1. Select connect to IDA
ida window prompts:
[IDACode] Client connected
2. Select execute script in
Execute the IDApython script currently displayed by vscode
3. Debug IDApython script
Select Connect and attach a debugger to IDA
and then add breakpoint() on the code side
and then ctrl+s automatically enter the debug breakpoint address
The demo is as follows:
import sys
import idc
breakpoint() #进入调试模式 会在这里断下
start = idc.get_screen_ea()
end = start+0x100
print("breakpoint before")
breakpoint() #进入调试模式 会在这里断下
print("breakpoint after")
print(sys.path)
Both vscode console and IDApython console will print information
reference
Debug IDAPython scripts in VSCode_Code Segment's Blog-CSDN Blog