|
1 | | -idacode |
| 1 | +# IDACode |
| 2 | +IDACode makes it easy to execute and debug Python 3 scripts in your IDA environment without leaving Visual Studio Code. The VS Code extension can be found on the [marketplace](). |
| 3 | + |
| 4 | +## Features |
| 5 | +* **Speed**: Quickly create and execute scripts. |
| 6 | +* **Debugging**: Attach a Python debugger at any time. |
| 7 | +* **Compatibility**: IDACode does not require you to modify your scripts in a specific way. All scripts can be executed from within IDA without changes. |
| 8 | +* **Modularity**: Since the |
| 9 | + |
| 10 | +IDACode only supports Python 3. If there's a need for Python 2 compatibility please vote [here](https://github.com/ioncodes/idacode/issues/3). |
| 11 | + |
| 12 | +## Setup |
| 13 | +To set up the dependencies for the IDA plugin run: |
| 14 | + |
| 15 | +```sh |
| 16 | +# make sure to use the correct Python version |
| 17 | +python3 -m pip install --user debugpy tornado |
| 18 | +``` |
| 19 | + |
| 20 | +Either clone this repository or download a release package from [here](https://github.com/ioncodes/idacode/releases). `ida.zip` reflects the contents of the `ida` folder in this repository. Copy all files into IDAs plugin directory. |
| 21 | + |
| 22 | +The next step is to configure your settings to match your environment. Edit `idacode_utils/settings.py` accordingly: |
| 23 | + |
| 24 | +* `HOST`: This is the host address. This is always `127.0.0.1` unless you want it to be accessible from a remote location. **Keep in mind that this plugin does not make use of authentication.** |
| 25 | +* `PORT`: This is the port you want IDA to listen to. This is used for websocket communication between IDA and VS Code. |
| 26 | +* `DEBUG_PORT`: This is the port you want to listen on for incoming debug sessions. |
| 27 | +* `PYTHON`: This is the absolute path to the Python distribution that your IDA setup uses. |
| 28 | + |
| 29 | +You can now start the plugin by clicking on `Start IDACode` in the plugins menu. |
| 30 | + |
| 31 | +The VS Code extension is available on the [marketplace](). To configure the extension please refer to the extension's [README](https://github.com/ioncodes/idacode/tree/master/idacode#extension-settings). |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +### IDA |
| 36 | +Hit `Start IDACode` in the plugin menu. You should be greeted with the following text: |
| 37 | + |
| 38 | +``` |
| 39 | +IDACode listening on 127.0.0.1:7065 |
| 40 | +``` |
| 41 | + |
| 42 | +### VS Code |
| 43 | +There are 4 commands at your disposal: |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +Once you have a folder open that you want to put your scripts in you are ready to connect to IDA. You can do so by either executing `Connect to IDA` or `Connect and attach a debugger to IDA`. Please keep in mind that a debug session is permanent until you restart IDA. You can not change the workspace folder once the debbuger has started. |
| 48 | +Ensure that the workspace folder is the folder that your main scripts is located. |
| 49 | +Once you are connected you are able to select `Execute script in IDA`. |
| 50 | + |
| 51 | +## Debugging |
| 52 | +IDACode uses VS Code's remote debugger to connect to IDA. All VS Code features are supported however, you have to specify the scripts entrypoint by using Python 3 builtin functionality: `breakpoint`. This instruction tells the debugger to pause execution, if there's no debugger present it will just ignore the function. When executing `breakpoint` in IDA, IDACode gives you additional features such as logging and conditionals which are not present in the normal builtin function. Here's an example: |
| 53 | + |
| 54 | +```py |
| 55 | +name = idc.get_segm_name(segment) |
| 56 | +breakpoint(name==".text", f"found {name} at {segment}") |
| 57 | +``` |
| 58 | + |
| 59 | +## Demo |
| 60 | + |
0 commit comments