Skip to content

Commit

Permalink
new cydia package, redirect log output to ~/Library/SP_Debug.log adde…
Browse files Browse the repository at this point in the history
…d warning dialog. some forgotten folders and files from initial commit
  • Loading branch information
FireCore, LLC committed Jan 14, 2011
1 parent 538edbc commit c4a79aa
Show file tree
Hide file tree
Showing 9 changed files with 1,889 additions and 127 deletions.
Binary file modified archives/Cydia.tgz
Binary file not shown.
17 changes: 16 additions & 1 deletion main.m
Expand Up @@ -7,8 +7,23 @@
//

#import <Cocoa/Cocoa.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
/*
char *val_buf, path_buf[155];
val_buf = getenv("HOME");
sprintf(path_buf,"%s/Library/Logs/Test.log",val_buf);
freopen(path_buf,"a",stderr);
*/
id pool = [NSAutoreleasePool new];

NSString *logPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Logs/SP_Debug.log"];
freopen([logPath fileSystemRepresentation], "a", stderr);

[pool release];
return NSApplicationMain(argc, (const char **) argv);
}

30 changes: 28 additions & 2 deletions nitoUtility.m
Expand Up @@ -14,7 +14,6 @@
*/

#import "nitoUtility.h"


#define NULLOUT [NSFileHandle fileHandleWithNullDevice]

Expand Down Expand Up @@ -504,6 +503,30 @@ - (void)permissionedPatch:(NSString *)theFile withOriginal:(NSString *)originalD
pwnHelper = nil;
}

+ (NSString *)applicationSupportFolder {

NSFileManager *man = [NSFileManager defaultManager];
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:
0] : NSTemporaryDirectory();
basePath = [basePath stringByAppendingPathComponent:@"Seas0nPass"];
if (![man fileExistsAtPath:basePath])
[man createDirectoryAtPath:basePath withIntermediateDirectories:YES attributes:nil error:nil];
return basePath;
}

+ (NSString *)wifiFile
{
NSString *wf = [[nitoUtility applicationSupportFolder] stringByAppendingPathComponent:@"com.apple.wifi.plist"];

if ([FM fileExistsAtPath:wf]) { return wf; }

return nil;

}

- (NSString *)pwnctionaryFromPath:(NSString *)mountedPath original:(NSString *)original withBundle:(NSDictionary *)theBundle
{
NSString *es = [NSString stringWithFormat:@"%i", (int)[self enableScripting]];
Expand All @@ -516,7 +539,10 @@ - (NSString *)pwnctionaryFromPath:(NSString *)mountedPath original:(NSString *)o
[fstabDict setObject:[[NSBundle mainBundle] pathForResource:@"fstab" ofType:@"patch" inDirectory:@"patches"] forKey:@"patchFile"];
[fstabDict setObject:@"e34d097a1c6dc7fd95db41879129327b" forKey:@"md5"];
[bundleDict setObject:[fstabDict autorelease] forKey:@"fstabPatch"];

if ([nitoUtility wifiFile] != nil)
{
[bundleDict setObject:[nitoUtility wifiFile] forKey:@"wifi"];
}
[bundleDict setObject:CYDIA_TAR forKey:@"cydia"];
[bundleDict setObject:SPACE_SCRIPT forKey:@"stash"];
//TODO: custom bundles
Expand Down
12 changes: 12 additions & 0 deletions pwnHelperClass.m
Expand Up @@ -137,6 +137,11 @@ - (int)installCydia:(NSString *)cydiaPackage withRoot:(NSString *)mountedPath
return [nitoUtility extractGZip:cydiaPackage toRoot:mountedPath];
}

- (void)installWifi:(NSString *)wifiFile withRoot:(NSString *)mountedPath
{
[FM copyItemAtPath:wifiFile toPath:[mountedPath stringByAppendingPathComponent:@"/Library/Preferences/SystemConfiguration/com.apple.wifi.plist"] error:nil];
}

- (int)stash:(NSString *)scriptFile withRoot:(NSString *)mountedPath
{
return [nitoUtility runScript:scriptFile withInput:mountedPath];
Expand Down Expand Up @@ -174,6 +179,13 @@ - (void)patchDmg:(NSString *)theDMG
[self changeStatus:@"Installing Software..."];
NSLog(@"installing Software...");
[self installCydia:[[self processDict] valueForKey:@"cydia"] withRoot:mountImage];

if ([[self processDict] valueForKey:@"wifi"] != nil)
{
[self changeStatus:@"Installing wifi.plist..."];
NSLog(@"installing wifi.plist...");
[self installWifi:[[self processDict] valueForKey:@"wifi"] withRoot:mountImage];
}
//[self changeStatus:@"Stash it away man!..."];
NSLog(@"Stash it away man!...");
[self stash:[[self processDict] valueForKey:@"stash"] withRoot:mountImage];
Expand Down
1,815 changes: 1,752 additions & 63 deletions tetherKit.xcodeproj/kevinbradley.pbxuser

Large diffs are not rendered by default.

80 changes: 22 additions & 58 deletions tetherKit.xcodeproj/kevinbradley.perspectivev3
Expand Up @@ -219,24 +219,24 @@
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>32DF57F712DD6F49002916D5</string>
<string>32DF72F412E0054C002916D5</string>
<key>PBXProjectModuleLabel</key>
<string>tetherKit-Info.plist</string>
<string>main.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>32DF57F812DD6F49002916D5</string>
<string>32DF72F512E0054C002916D5</string>
<key>PBXProjectModuleLabel</key>
<string>tetherKit-Info.plist</string>
<string>main.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>32DF57F912DD6F49002916D5</string>
<string>32DF72FD12E0056F002916D5</string>
<key>history</key>
<array>
<string>32DF57F512DD6F45002916D5</string>
<string>32DF72F612E0054C002916D5</string>
</array>
</dict>
<key>SplitCount</key>
Expand All @@ -248,11 +248,11 @@
<key>Geometry</key>
<dict>
<key>Frame</key>
<string>{{0, 20}, {1529, 1257}}</string>
<string>{{0, 20}, {1786, 787}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
<string>75 93 1529 1298 0 0 2560 1418 </string>
<string>107 501 1786 828 0 0 2560 1418 </string>
</dict>
</dict>
<dict>
Expand All @@ -273,7 +273,7 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>32DF57FA12DD6F49002916D5</string>
<string>32DF72FE12E0056F002916D5</string>
<key>history</key>
<array>
<string>32DF567412DD35EB002916D5</string>
Expand All @@ -295,46 +295,6 @@
<string>701 98 1496 1273 0 0 2560 1418 </string>
</dict>
</dict>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>32DF562D12DD32F6002916D5</string>
<key>PBXProjectModuleLabel</key>
<string>tetherKitAppDelegate.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>32DF562E12DD32F6002916D5</string>
<key>PBXProjectModuleLabel</key>
<string>tetherKitAppDelegate.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>32DF57FB12DD6F49002916D5</string>
<key>history</key>
<array>
<string>32DF565E12DD35A7002916D5</string>
</array>
</dict>
<key>SplitCount</key>
<string>1</string>
</dict>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>Geometry</key>
<dict>
<key>Frame</key>
<string>{{0, 20}, {1496, 1232}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
<string>754 124 1496 1273 0 0 2560 1418 </string>
</dict>
</dict>
</array>
<key>PerspectiveWidths</key>
<array>
Expand Down Expand Up @@ -406,6 +366,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
<array>
<string>29B97314FDCFA39411CA2CEA</string>
<string>080E96DDFE201D6D7F000001</string>
<string>29B97317FDCFA39411CA2CEA</string>
<string>29B97323FDCFA39411CA2CEA</string>
<string>1C37FBAC04509CD000000102</string>
Expand Down Expand Up @@ -453,19 +414,19 @@
<key>PBXProjectModuleGUID</key>
<string>327203A712C942470054F4B0</string>
<key>PBXProjectModuleLabel</key>
<string>Sparkle.h</string>
<string>tweak.xm</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>327203A812C942470054F4B0</string>
<key>PBXProjectModuleLabel</key>
<string>Sparkle.h</string>
<string>tweak.xm</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>32DF57F612DD6F49002916D5</string>
<string>32DF72FC12E0056F002916D5</string>
<key>history</key>
<array>
<string>3272092B12C9F0520054F4B0</string>
Expand All @@ -482,7 +443,6 @@
<string>3200018E12D5AB13003EA66E</string>
<string>3200018F12D5AB13003EA66E</string>
<string>3200019012D5AB13003EA66E</string>
<string>3200019112D5AB13003EA66E</string>
<string>3200019212D5AB13003EA66E</string>
<string>3200019312D5AB13003EA66E</string>
<string>3200019412D5AB13003EA66E</string>
Expand All @@ -497,10 +457,15 @@
<string>32DF4A4E12DC43C4002916D5</string>
<string>32DF54B212DCE52B002916D5</string>
<string>32DF551D12DCEB30002916D5</string>
<string>32DF568912DD60EB002916D5</string>
<string>32DF57C912DD6E91002916D5</string>
<string>32DF57CA12DD6E91002916D5</string>
<string>32DF57F012DD6F3B002916D5</string>
<string>32DF5B2A12DDA405002916D5</string>
<string>32DF65CB12DDA77B002916D5</string>
<string>32DF661112DF921A002916D5</string>
<string>32DF661212DF921A002916D5</string>
<string>32DF662312DF9257002916D5</string>
<string>32DF71A312DF9F81002916D5</string>
<string>32DF72EE12E00549002916D5</string>
<string>32DF72FB12E0056D002916D5</string>
</array>
</dict>
<key>SplitCount</key>
Expand Down Expand Up @@ -821,10 +786,9 @@
<array>
<string>32DF561F12DD2887002916D5</string>
<string>32DF562012DD2887002916D5</string>
<string>32DF562D12DD32F6002916D5</string>
<string>32DF563012DD32F6002916D5</string>
<string>32DF72F412E0054C002916D5</string>
<string>/Users/kevinbradley/Projects/Seas0nPass/tetherKit.xcodeproj</string>
<string>32DF57F712DD6F49002916D5</string>
</array>
<key>WindowString</key>
<string>175 126 1940 1283 0 0 2560 1418 </string>
Expand Down
2 changes: 0 additions & 2 deletions tetherKit.xcodeproj/project.pbxproj
Expand Up @@ -163,7 +163,6 @@
327206A812C9C32A0054F4B0 /* nitoUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nitoUtility.h; sourceTree = "<group>"; };
327206A912C9C32A0054F4B0 /* nitoUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = nitoUtility.m; sourceTree = "<group>"; };
32720A0B12CAD3780054F4B0 /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/gcc/i686-apple-darwin10/4.0.1/libstdc++.dylib"; sourceTree = SDKROOT; };
32720BFF12CB39A90054F4B0 /* manual ipsw.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = "manual ipsw.rtf"; sourceTree = "<group>"; };
32720C1312CB3A6C0054F4B0 /* bin */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bin; sourceTree = "<group>"; };
32720E7512CC53770054F4B0 /* dbHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dbHelper; sourceTree = BUILT_PRODUCTS_DIR; };
32720E8912CC53E20054F4B0 /* pwnHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = pwnHelper.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -224,7 +223,6 @@
32720F1012CC66E10054F4B0 /* PatchedFile.m */,
32720EF012CC63F80054F4B0 /* FWManager.h */,
32720EF112CC63F80054F4B0 /* FWManager.m */,
32720BFF12CB39A90054F4B0 /* manual ipsw.rtf */,
327206A812C9C32A0054F4B0 /* nitoUtility.h */,
327206A912C9C32A0054F4B0 /* nitoUtility.m */,
256AC3D80F4B6AC300CF3369 /* tetherKitAppDelegate.h */,
Expand Down
2 changes: 2 additions & 0 deletions tetherKitAppDelegate.h
Expand Up @@ -44,6 +44,8 @@ enum {
@property (readwrite, assign) BOOL poisoning;
@property (readwrite, assign) BOOL enableScripting;
@property (readwrite, assign) int downloadIndex;
+ (NSString *)applicationSupportFolder;
+ (NSString *)wifiFile;
- (IBAction)fixScript:(id)sender;
- (void)killiTunes;
- (void)checkScripting;
Expand Down
58 changes: 57 additions & 1 deletion tetherKitAppDelegate.m
Expand Up @@ -132,6 +132,59 @@ - (NSImage *)imageForMode:(int)inputMode
return theImage;
}

- (void)startupAlert
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL warningShown = [defaults boolForKey:@"SPWarningShown"];
if (warningShown == TRUE)
return;

NSAlert *startupAlert = [NSAlert alertWithMessageText:@"Warning! Please read carefully." defaultButton:@"OK" alternateButton:@"More Info" otherButton:@"Cancel" informativeTextWithFormat:@"Currently the jailbreak for the 4.1.1 (iOS 4.2.1) software is 'tethered'. A tethered jailbreak requires the AppleTV to be connected to a computer for a brief moment during startup.\n\nSeas0nPass makes this as easy as possible, but please do not proceed unless you are comfortable with this process."];
int button = [startupAlert runModal];

switch (button) {
case 0: //more info

[self userGuides:nil];
break;

case 1: //okay

break;

case -1: //cancel and quit!!
[[NSApplication sharedApplication] terminate:self];
break;

}

[defaults setBool:YES forKey:@"SPWarningShown"];

}

+ (NSString *)applicationSupportFolder {

NSFileManager *man = [NSFileManager defaultManager];
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:
0] : NSTemporaryDirectory();
basePath = [basePath stringByAppendingPathComponent:@"Seas0nPass"];
if (![man fileExistsAtPath:basePath])
[man createDirectoryAtPath:basePath withIntermediateDirectories:YES attributes:nil error:nil];
return basePath;
}

+ (NSString *)wifiFile
{
NSString *wf = [[tetherKitAppDelegate applicationSupportFolder] stringByAppendingPathComponent:@"com.apple.wifi.plist"];

if ([FM fileExistsAtPath:wf]) { return wf; }

return nil;

}

+ (NSString *)ipswFile
{
Expand Down Expand Up @@ -444,9 +497,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.poisoning = FALSE;
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(pwnFinished:) name:@"pwnFinished" object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(statusChanged:) name:@"statusChanged" object:nil];
[self startupAlert];
[self pwnHelperCheckOwner];
[self checkScripting];
[FM removeFileAtPath:TMP_ROOT handler:nil];
[FM removeItemAtPath:TMP_ROOT error:nil];

//NSLog(@"appS: %@", [tetherKitAppDelegate wifiFile]);

}

Expand Down

0 comments on commit c4a79aa

Please sign in to comment.