0

I am doing experiments on my cocoa mac application ,found I can dump all header files (.h files) of my application executable file using another class-dump executable available on Github.

I want to know how can I prevent my application from header files dump using any 3rd party executable like class-dump.

Command for Dumping:

./class-dump -H /Users/abc/Documents/app -o ./Headerfiles

Any Suggestions

Thanks in Advance

tsmac
  • 1
  • 1
  • 1
    Possible duplicate of [Obj C and class-dump protection](https://stackoverflow.com/questions/4605346/obj-c-and-class-dump-protection) – eckenrod Dec 13 '18 at 16:32

1 Answers1

1

I doubt there's any way to prevent this.

Objective-C class, method, property, protocol, and category information is all registered dynamically at runtime. Therefore, your executable's __DATA section must contain all of this information. Tools like class-dump simply reverse engineer these tables to create an equivalent interface (.h) file.

The only way to get around this would be to programmatically create your classes at runtime, which in my opinion would be just crazy.

An ugly, half-solution—full of potential problems—would be to try some form of code obfuscation:

#define MyClass m0
#define doSomething m1
#define userClickedButton m2
#define hitCount m3

@interface MyClass
- (void)doSomething;
- (IBAction)userClickedButton:(id)sender;
@property NSUInteger hitCount;

would appear in the compiled application as

@interface m0
- (void)m1;
- (void)m2:(id)o;
- (unsigned long)m3;
- (void)setM3:(unsigned long)n;
James Bucanek
  • 3,299
  • 3
  • 14
  • 30
  • Thanks for your response.Now I am in fear that can my methods implementation can also be reverse engineered means like "class-dump" executable can get my code also ? is it also possible ? – tsmac Dec 14 '18 at 06:39
  • @also i checked NordVPN executable but it stops me to dump header using the same executable (class-dump) how Nord can prevent me to dump headers. – tsmac Dec 14 '18 at 14:32
  • Fact: All code can be reverse engineered. The instructions that make your program run must be readable by the CPU, and if they're readable by the CPU, someone can use that CPU to decode them and figure out what they do. This has always been true, and will probably continue to be true during our lifetimes (quantum computers that rely on not being able to observe a quantum state without changing it *might* be a solution to this, but that's a ways off). – James Bucanek Dec 14 '18 at 17:15
  • I have no idea how NordVPN does it, but I suspect NordVPN isn't an Objective-C program; most cross platform solutions aren't. – James Bucanek Dec 14 '18 at 17:16