vscode idapython debug

vscode idapython debug

1、在脚本中嵌入debugpy

import sys
#python3.exe -m pip install debugpy
# sys.path.append(r"D:\IDA Pro 7.6\Lib\site-packages\debugpy")
import debugpy

DEBUG_HOST = '127.0.0.1'
DEBUG_PORT = 5678

# required for hosted Python (e.g. Maya)
# got it from pyenv python >>> print(sys.executable)
#python_path=sys.executable #r"D:\IDA Pro 7.6\python3.exe"
#debugpy.configure(python=python_path)
debugpy.listen((DEBUG_HOST, DEBUG_PORT),in_process_debug_adapter=True)
idaapi.msg('listen\n')
'''
try:
    debugpy.listen((DEBUG_HOST, DEBUG_PORT),in_process_debug_adapter=True)
    idaapi.msg('listen\n')
except RuntimeError as e:
# except Exception as e:
    idaapi.msg(str(e))
    if "Only one usage of each socket address" in str(e):
        pass
'''
debugpy.wait_for_client()
idaapi.msg('breakpoint\n')
debugpy.breakpoint()

2、vscode python附加

launch.json

配置python attach

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Attach ",
            "type": "python",
            "request": "attach",
            "justMyCode": false,
            "port": 5678,
            "host": "127.0.0.1",
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "${workspaceFolder}",
                }
            ]
        }
    ]
}

settings.json

方便调试,非必要

{
//add this
    "python.autoComplete.extraPaths": [
        "D:\\IDA Pro 7.6\\python\\3"
    ],
    "python.analysis.extraPaths": [
        "D:\\IDA Pro 7.6\\python\\3"
    ]
}

参考链接

https://community.shotgridsoftware.com/t/remote-debugging/3869/9

posted @   DirWangK  阅读(135)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示
目录导航
目录导航
vscode idapython debug
vscode idapython debug
1、在脚本中嵌入debugpy
2、vscode python附加
launch.json
settings.json
参考链接
发布于 2023-03-07 10:32