Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to inject into iOS simulator app #7

Open
olbrichj opened this issue Nov 9, 2018 · 0 comments
Open

Trying to inject into iOS simulator app #7

olbrichj opened this issue Nov 9, 2018 · 0 comments

Comments

@olbrichj
Copy link

olbrichj commented Nov 9, 2018

I love this tool!
Currently I try to use it to inject a lib into an app running within the iOS simulator. At first it seemed quite simple. I can inject my own dylib into the testapp, but for some reason nothing happens when I try to inject it into a process within the simulator.

As far as I can see, the simulator just spawns more processes and I don't really have to care about it. Instead I can just search for the process name and be done.

I've build a dynamic framework (which basically contains a dylib) for the simulator (it's also 86_64).

injection.mm

#include <cstdio>
#import "Main.h"

void install(void) __attribute__ ((constructor));
void install()
{
    [Main injectionTest];
}

Main.h

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface Main : NSObject
+ (void)injectionTest;
@end
NS_ASSUME_NONNULL_END

Main.m

#import "Main.h"
@implementation Main
+ (void)injectionTest {
    [[NSFileManager defaultManager] createFileAtPath:@"/Users/jan/Downloads/osxinj/test.txt" contents:nil attributes:nil];
    [@"Hello Simulator" writeToFile:@"/Users/jan/Downloads/osxinj/test.txt" atomically:YES encoding:NSUTF8StringEncoding error:nil];
    NSLog(@"Hello Simulator");
}
@end

The good thing, I can inject Obj-C code into the testapp. The bad thing, I don't have any output from the simulator. As you can see I even tried breaking out and write a file to a specific directory.

Any ideas, what I'm doing wrong, or what I'm missing?

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

No branches or pull requests

1 participant