# Avoid XREF in Hopper and IDA

This post demonstrates how to avoid XREF in Hopper and IDA.

In other language:

This is our tiny example code,

#include <iostream>
int main(int argc, const char * argv[]) {
const char * cstring = "This is tricky!";
printf("%s\n",cstring);
return 0;
}


Disassemblers can easily find out where do we use the cstring. As shown in Figure 1.

Double-click _main+15, and Hopper will bring us to the main function. As shown in Figure 2.

To avoid XREF, we can simply modify our code into this:

#include <iostream>
int main(int argc, const char * argv[]) {
const char * cstring = "1This is tricky!";
printf("%s\n",cstring);
return 0;
}


After compilation, a little more modification is required.

Find this line (as shown in Figure 3) in your disassembler, remember its location. Then open this binary in a hex editor.

Because we add 1 more char in our cstring, so we just replace 50 with 51, then save it.

Now, drag and drop this binary file into your disassembler, and there is no more XREF to main.

声明: 本文为0xBBC原创, 转载注明出处喵～