Add AppDelegate.h

This commit is contained in:
veracode 2014-05-13 00:10:05 -05:00
commit 3fcf6ee19e
15 changed files with 536 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

15
AppDelegate.h Normal file
View File

@ -0,0 +1,15 @@
//
// AppDelegate.h
// iRE
//
// Created by veracode on 11/8/13.
// Copyright (c) 2013 veracode. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

47
AppDelegate.m Normal file
View File

@ -0,0 +1,47 @@
//
// AppDelegate.m
// iRE
//
// Created by veracode on 11/8/13.
// Copyright (c) 2013 veracode. All rights reserved.
//
#import "AppDelegate.h"
#include <stdlib.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
</dependencies>
<scenes>
<!--class Prefix:identifier View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="20" width="768" height="1004"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackOpaque"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<deployment defaultVersion="1552" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="zDL-3q-phn"/>
<viewControllerLayoutGuide type="bottom" id="oOM-yR-gR1"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

View File

@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "57x57",
"scale" : "1x"
},
{
"idiom" : "iphone",
"size" : "57x57",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon.png",
"unassigned" : true,
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,51 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

20
ViewController.h Normal file
View File

@ -0,0 +1,20 @@
//
// ViewController.h
// iRE
//
// Created by veracode on 11/8/13.
// Copyright (c) 2013 veracode. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
UILabel*lblHeader;
UILabel*lblMessage;
UILabel*lblIPText;
UILabel*lblIPAddress;
UILabel*lbliRET;
}
@end

226
ViewController.m Normal file
View File

@ -0,0 +1,226 @@
//
// ViewController.m
// iRE
//
// Created by veracode on 11/8/13.
// Copyright (c) 2013 veracode. All rights reserved.
//
#import "ViewController.h"
#include <ifaddrs.h>
#include <arpa/inet.h>
@interface ViewController ()
@end
@implementation ViewController
UIButton*btnStart;
int intButtonState;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
float rd = 3.0/255.0;
float gr = 119.0/255.0;
float bl = 204.0/255.0;
self.view.backgroundColor = [UIColor colorWithRed:rd green:gr blue:bl alpha:1.0];
//ADD THE HEADER LABEL
lblHeader = [[UILabel alloc]
initWithFrame:CGRectMake(0,10,320,100)];
lblHeader.text = @"Welcome to iRET";
lblHeader.backgroundColor = [UIColor clearColor];
lblHeader.textColor = [UIColor whiteColor];
lblHeader.font = [UIFont fontWithName:@"Arial-BoldMT" size:25.0];
lblHeader.textAlignment = NSTextAlignmentCenter;
//ADD THE HEADER LABEL
lbliRET = [[UILabel alloc]
initWithFrame:CGRectMake(0,60,320,100)];
lbliRET.text = @"The iOS Reverse Engineering Toolkit";
lbliRET.backgroundColor = [UIColor clearColor];
lbliRET.textColor = [UIColor whiteColor];
lbliRET.font = [UIFont fontWithName:@"Arial-BoldMT" size:15.0];
lbliRET.textAlignment = NSTextAlignmentCenter;
//ADD THE MESSAGE LABEL
lblMessage = [[UILabel alloc]
initWithFrame:CGRectMake(0,100,320,100)];
lblMessage.numberOfLines = 0;
lblMessage.lineBreakMode = true;
lblMessage.text = @"For on device analysis and reversing.";
lblMessage.backgroundColor = [UIColor clearColor];
lblMessage.textColor = [UIColor whiteColor];
lblMessage.font = [UIFont fontWithName:@"Arial-BoldMT" size:10.0];
lblMessage.textAlignment = NSTextAlignmentCenter;
//ADD THE BUTTON
UIButton*btnStart = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btnStart.frame = CGRectMake(105,175,100,35);
btnStart.backgroundColor = [UIColor whiteColor];
[btnStart.titleLabel setTextColor:[UIColor blackColor]];
[btnStart.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
[btnStart setTitle:@"Start" forState:UIControlStateNormal];
[btnStart addTarget:self action:@selector(btnStartPressed:) forControlEvents:UIControlEventTouchUpInside];
//ADD THE IP Text LABEL
lblIPText = [[UILabel alloc]
initWithFrame:CGRectMake(0,225,320,100)];
lblIPText.backgroundColor = [UIColor clearColor];
lblIPText.textColor = [UIColor whiteColor];
lblIPText.font = [UIFont fontWithName:@"Arial-BoldMT" size:20.0];
lblIPText.textAlignment = NSTextAlignmentCenter;
//ADD THE IP Address LABEL
lblIPAddress = [[UILabel alloc]
initWithFrame:CGRectMake(0,275,320,200)];
lblIPAddress.backgroundColor = [UIColor clearColor];
lblIPAddress.textColor = [UIColor blackColor];
lblIPAddress.font = [UIFont fontWithName:@"Arial-BoldMT" size:15.0];
lblIPAddress.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:lblHeader];
[self.view addSubview:lblMessage];
[self.view addSubview:btnStart];
[self.view addSubview:lblIPText];
[self.view addSubview:lblIPAddress];
[self.view addSubview: lbliRET];
}
-(void) btnStartPressed:(UIButton *) sender
{
//START THE LISTENER
NSString *strIP;
if (intButtonState == 0)
{
intButtonState = 1;
@try
{
//change the button text to show 'Stop'
[sender setTitle: @"Stop" forState: UIControlStateNormal];
int loadResult = system("launchctl load /System/Library/LaunchDaemons/com.jensen.iRE.Startup.plist");
NSLog(@" Load Startup Result: %i", loadResult);
if(loadResult == 0)
strIP = [self getIPAddress];
strIP = [strIP stringByAppendingString:@":5555"];
lblIPText.text = @"Navigate your browser to:";
lblIPAddress.text = strIP;
}
@catch (NSException *exception)
{
NSLog( @"NSException caught ");
NSLog( @"Name: %@", exception.name);
NSLog( @"Reason: %@", exception.reason);
}
@finally
{
NSLog( @"In finally block.");
}
}
else if (intButtonState == 1)
{
//STOP THE LISTENER
intButtonState = 0;
@try {
//change the button text to show 'Start'
[sender setTitle: @"Start" forState: UIControlStateNormal];
int unloadStart = system("launchctl unload /System/Library/LaunchDaemons/com.jensen.iRE.Startup.plist");
NSLog(@"Unload Start Result: %i", unloadStart);
lblIPText.text = @"";
lblIPAddress.text = @"";
}
@catch (NSException *exception) {
NSLog( @"NSException caught ");
NSLog( @"Name: %@", exception.name);
NSLog( @"Reason: %@", exception.reason);
}
@finally {
NSLog( @"In finally block.");
}
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSString *)getIPAddress {
NSString *address = @"error";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
// retrieve the current interfaces - returns 0 on success
success = getifaddrs(&interfaces);
if (success == 0) {
// Loop through linked list of interfaces
temp_addr = interfaces;
while(temp_addr != NULL) {
if(temp_addr->ifa_addr->sa_family == AF_INET) {
// Check if interface is en0 which is the wifi connection on the iPhone
if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) {
// Get NSString from C String
address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
}
}
temp_addr = temp_addr->ifa_next;
}
}
// Free memory
freeifaddrs(interfaces);
return address;
}
@end

BIN
com.jensen.iRE.Startup.plist Executable file

Binary file not shown.

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

45
iRE-Info.plist Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.jensen.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
<key>UIMainStoryboardFile</key>
<string>Main_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main_iPad</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

16
iRE-Prefix.pch Normal file
View File

@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

22
main.m Normal file
View File

@ -0,0 +1,22 @@
//
// main.m
// iRE
//
// Created by veracode on 11/8/13.
// Copyright (c) 2013 veracode. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
setuid(0);
setgid(0);
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}