Skip to content

Commit

Permalink
App Crawler 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YungRaj committed Mar 18, 2023
1 parent c20323a commit 1106cad
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 78 deletions.
6 changes: 3 additions & 3 deletions make_inject.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ ARM64_ASMSOURCES := $(wildcard arm64/*.s)
ARM64_ASMOBJECTS := $(patsubst arm64/%.s, $(OBJ)/%.o, $(ARM64_ASMSOURCES))
endif

CFLAGS += -Wno-shadow -Wno-unused-variable -g -D__USER__ -DCAPSTONE_HAS_X86=1 -DCAPSTONE_HAS_ARM64=1 -I./keystone/include -I./capstone/include -I./user -I./mac_rootkit -I./
CFLAGS += -fobjc-arc -Wno-shadow -Wno-unused-variable -g -D__USER__ -DCAPSTONE_HAS_X86=1 -DCAPSTONE_HAS_ARM64=1 -I./keystone/include -I./capstone/include -I./user -I./mac_rootkit -I./

LDFLAGS += -framework IOKit -framework CoreFoundation -L/usr/local/lib /usr/local/lib/libcapstone.a /usr/local/lib/libkeystone.a -std=c++11 -Wc++11-extensions -DCAPSTONE_HAS_X86=1 -DCAPSTONE_HAS_ARM64=1 -I./keystone/include -I./capstone/include -I./user -I./mac_rootkit -I./
LDFLAGS += -fobjc-arc -framework IOKit -framework CoreFoundation -L/usr/local/lib /usr/local/lib/libcapstone.a /usr/local/lib/libkeystone.a -std=c++11 -Wc++11-extensions -DCAPSTONE_HAS_X86=1 -DCAPSTONE_HAS_ARM64=1 -I./keystone/include -I./capstone/include -I./user -I./mac_rootkit -I./

CXXFLAGS += -D__USER__ -std=c++11 -Wc++11-extensions -Wno-sign-conversion -Wno-writable-strings
CXXFLAGS += -fobjc-arc -D__USER__ -std=c++11 -Wc++11-extensions -Wno-sign-conversion -Wno-writable-strings

.PHONY: all clean

Expand Down
2 changes: 1 addition & 1 deletion make_ios_app_crawler.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COMMON_OBJECTS := $(patsubst user/%.mm, $(OBJ)/%.o, $(COMMON_SOURCES))

CFLAGS += -g -I$(shell pwd)/mac_rootkit -I$(shell pwd)/user/FakeTouch -arch arm64 -target arm64-apple-ios

LDFLAGS += -g -shared -arch arm64 -target arm64-apple-ios -framework UIKit -framework Foundation -framework IOKit -framework CoreGraphics -framework QuartzCore
LDFLAGS += -g -shared -arch arm64 -target arm64-apple-ios -framework UIKit -framework Foundation -framework IOKit -framework CoreGraphics -framework QuartzCore -framework SpriteKit

CXXFLAGS += -g -I$(shell pwd)/mac_rootkit -arch arm64 -target arm64-apple-macos

Expand Down
33 changes: 19 additions & 14 deletions user/Crawler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@

#include <UIKit/UIKit.h>
#include <Foundation/Foundation.h>
#include <SpriteKit/SpriteKit.h>

/* iOS App Crawler for macOS */
/*****************************/
/* Crawler will use depth first search */
/* Store previously crawled UI elements */

/* NSDictionary
* {
* "viewController" -> NSArray
* "UIView-300-200-50-20" -> NSString
* }
*/

namespace NSDarwin
{
namespace AppCrawler
Expand All @@ -36,26 +30,28 @@ using namespace NSDarwin::AppCrawler;
@property (strong, nonatomic) NSString *parent;

@property (assign, nonatomic) CGRect frame;
@property (assign, nonatomic) CGPoint position; // position in window
@property (assign, nonatomic) CGPoint center;

@property (assign, nonatomic) CGPoint anchorPoint;
@end

@interface NSDarwinAppCrawler : NSObject

@property (nonatomic) CrawlManager *crawlManager;
@property (atomic) CrawlManager *crawlManager;

@property (strong, nonatomic) NSMutableDictionary *crawlData;
@property (strong, atomic) NSMutableDictionary *crawlData;

-(instancetype)initWithCrawlingManager:(CrawlManager*)crawlManager;

-(NSMutableDictionary*)crawlData;

-(NSViewCrawlData*)setupCrawlDataForView:(UIView*)view;

-(BOOL)hasViewBeenCrawled:(UIView*)view;
-(BOOL)hasViewBeenCrawled:(UIView*)view inViewController:(UIViewController*)vc;

-(void)crawlingTimerDidFire:(NSTimer*)timer;
-(void)idlingTimerDidFire:(NSTimer*) timer;

-(void)simulateTouchEventAtPoint:(CGPoint)point;

Expand Down Expand Up @@ -90,19 +86,27 @@ namespace NSDarwin

void setupAppCrawler();

void setupCrawlingTimer() { [NSTimer scheduledTimerWithTimeInterval:1.5f
void setupCrawlingTimer(NSDictionary *userInfo) { this->crawlingTimer = [NSTimer scheduledTimerWithTimeInterval:1.5f
target:this->crawler
selector:@selector(crawlingTimerDidFire:)
userInfo:userInfo
repeats:NO]; }

void setupIdleTimer() { this->idleTimer = [NSTimer scheduledTimerWithTimeInterval:10.0f
target:this->crawler
selector:@selector(idlingTimerDidFire:)
userInfo:nil
repeats:YES]; }

void invalidateCrawlingTimer() { if([crawlingTimer isValid]) [crawlingTimer invalidate]; }
void invalidateCrawlingTimer() { if(this->crawlingTimer && [this->crawlingTimer isValid]) { [this->crawlingTimer invalidate]; this->crawlingTimer = NULL; } }

NSArray* getViewsForUserInteraction();
NSArray* getViewsForUserInteractionFromRootView(UIView *view);
NSMutableArray* getViewsForUserInteraction(UIViewController *viewController);
NSMutableArray* getViewsForUserInteractionFromRootView(UIView *view);

NSArray* getViewsWithClassName(NSArray *views, const char *class_name);



void onViewControllerViewDidLoad(UIViewController *viewController);

private:
Expand All @@ -113,6 +117,7 @@ namespace NSDarwin
NSString *bundleIdentifier;

NSTimer *crawlingTimer;
NSTimer *idleTimer;

UIApplication *application;

Expand Down
Loading

0 comments on commit 1106cad

Please sign in to comment.