Skip to content

Conversation

@withzombies
Copy link
Contributor

Adds a paginated list_imports.

Returns data that looks like this:

{
  "data": [
    {
      "module": ".dynsym",
      "import": "sprintf@@GLIBC_2.0",
      "address": "0x804e580",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "err@@GLIBC_2.0",
      "address": "0x804e584",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "signal@@GLIBC_2.0",
      "address": "0x804e588",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "recv@@GLIBC_2.0",
      "address": "0x804e58c",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "calloc@@GLIBC_2.0",
      "address": "0x804e590",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "listen@@GLIBC_2.0",
      "address": "0x804e594",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "__libc_start_main@@GLIBC_2.0",
      "address": "0x804e598",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "htons@@GLIBC_2.0",
      "address": "0x804e59c",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "setegid@@GLIBC_2.0",
      "address": "0x804e5a0",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "read@@GLIBC_2.0",
      "address": "0x804e5a4",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "free@@GLIBC_2.0",
      "address": "0x804e5a8",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "accept@@GLIBC_2.0",
      "address": "0x804e5ac",
      "ordinal": "0x0"
    },
    {
      "module": ".dynsym",
      "import": "socket@@GLIBC_2.0",
      "address": "0x804e5b0",
      "ordinal": "0x0"
    }
  ],
  "next_offset": null
}

Copy link
Owner

@mrexodia mrexodia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, I added some review comments to be addressed.

"module": module_name,
"import": symbol_name,
"address": f"{ea:#x}",
"ordinal": f"#{ordinal}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the ordinal provide any kind of value? As far as I know this is just what IDA uses as an index to identify that specific import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can import (and export) symbols via ordinals on Windows. However, I'm not sure how common that is outside of malware so I removed it for now.


acc += [{
"module": module_name,
"import": symbol_name,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer calling this name or function, or did you observe calling it import improve LLM performance in some way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to imported_name since it could be a function or a global object.

@withzombies withzombies requested a review from mrexodia June 23, 2025 10:46
@mrexodia mrexodia merged commit c4fe508 into mrexodia:main Jun 24, 2025
@mrexodia
Copy link
Owner

Awesome, thanks!

@withzombies withzombies deleted the list-imports branch July 1, 2025 23:58
can1357 pushed a commit to can1357/ida-pro-mcp that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants