Skip to content

Instantly share code, notes, and snippets.

@extremecoders-re
Created June 26, 2019 09:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save extremecoders-re/d0a6f9a8697e530172e65844dead5bb4 to your computer and use it in GitHub Desktop.
Save extremecoders-re/d0a6f9a8697e530172e65844dead5bb4 to your computer and use it in GitHub Desktop.
IDC Script to do hexdump
//
// IDC Script to do hexdump
//
auto i;
auto addr = get_inf_attr(INF_MIN_EA);
auto max_addr = get_inf_attr(INF_MAX_EA);
auto ofile = fopen("hexdump.txt", "w");
auto b;
for (addr=0; addr<max_addr; addr=addr+16)
{
fprintf(ofile, "%08X ", addr);
for (i=addr; i < addr+16; i++)
{
if (is_loaded(i) == 1)
{
b = byte(i);
fprintf(ofile, "%02X ", byte(i));
}
else
fprintf(ofile, "?? ", byte(i));
}
fprintf(ofile, " ");
for (i=addr; i < addr+16; i++)
{
if (is_loaded(i) == 1)
{
b = byte(i);
if (b >= 32 && b < 127)
fprintf(ofile, "%c", b);
else
fprintf(ofile, ".");
}
else
fprintf(ofile, "?");
}
fprintf(ofile, "\n");
}
fclose(ofile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment