Skip to content

Instantly share code, notes, and snippets.

@MayerDaniel
Last active May 19, 2022 17:41
Show Gist options
  • Save MayerDaniel/9d90ea93ebb42d4412d53458b21e7404 to your computer and use it in GitHub Desktop.
Save MayerDaniel/9d90ea93ebb42d4412d53458b21e7404 to your computer and use it in GitHub Desktop.
How to add macros as enums to IDA

copy the macros into atom, for example:

#define GET_FILE 1
#define PUT_FILE 2
#define RUNSHELL 3

Use atom and its regex find and replace to convert into a valid enum.

Here's the regex find and replace that works for this example:

#define (\S+)\s+(\S+)$

->

$1 = $2,

add in some brackets, a semicolon, and an enum declaration

enum  my_enum
{
GET_FILE = 1,
PUT_FILE = 2,
RUNSHELL = 3
};

Now you can either write this as a header file and load it using file -> load -> parse c header file or you can do it the 1337 way and head to the local types tab, press ctrl+i, and then just paste it in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment