-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathnitoUtility.h
110 lines (96 loc) · 5.28 KB
/
nitoUtility.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
// nitoUtility.h
// Seas0nPass
//
// Created by Kevin Bradley on 3/20/09.
// Copyright 2009 nito, LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "PatchedFile.h"
#import "FWBundle.h"
#import "NSData+Flip.h"
#define XPWN [[NSBundle mainBundle] pathForResource:@"xpwntool" ofType:@"" inDirectory:@"bin"]
#define IMAGE_TOOL [[NSBundle mainBundle] pathForResource:@"imagetool" ofType:@"" inDirectory:@"bin"]
#define VFDECRYPT [[NSBundle mainBundle] pathForResource:@"vfdecrypt" ofType:@"" inDirectory:@"bin"]
#define CYDIA_TAR [[NSBundle mainBundle] pathForResource:@"Cydia" ofType:@"tgz" inDirectory:@"archives"]
#define SPACE_SCRIPT [[NSBundle mainBundle] pathForResource:@"space" ofType:@"sh" inDirectory:@"scripts"]
#define SPACE_SCRIPT60 [[NSBundle mainBundle] pathForResource:@"space60" ofType:@"sh" inDirectory:@"scripts"]
#define DEB_PATH [[NSBundle mainBundle] pathForResource:@"debs" ofType:@""]
#define DEB_PATH_CUSTOM [[nitoUtility applicationSupportFolder] stringByAppendingPathComponent:@"Debs"]
#define HDIUTIL @"/usr/bin/hdiutil"
#define ASR @"/usr/sbin/asr"
#define BSPATCH @"/usr/bin/bspatch"
#define FM [NSFileManager defaultManager]
#define TMP_ROOT @"/private/tmp/tk"
#define IPSW_TMP @"/private/tmp/tk/ipsw"
enum{
kDMGReadWrite = 0,
kDMGReadOnly = 1,
};
@interface nitoUtility : NSObject {
id delegate;
BOOL enableScripting;
BOOL sigServer;
BOOL debWhitelist;
NSString *sshKey;
FWBundle *currentBundle;
int restoreMode;
}
@property (readwrite, assign) BOOL enableScripting;
@property (readwrite, assign) BOOL sigServer;
@property (readwrite, assign) BOOL debWhitelist;
@property (readwrite, assign) int restoreMode;
@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) NSString *sshKey;
@property (nonatomic, assign) FWBundle *currentBundle;
+ (int)restoreIPSW:(NSString *)theIPSW force:(BOOL)forced;
+ (BOOL)is64Bit;
+ (NSString *)singleLineReturnForProcess:(NSString *)call;
+ (int)restoreIPSW:(NSString *)theIPSW;
- (void)failedWithReason:(NSString *)theReason;
+ (int)patchFile:(NSString *)patchFile withPatch:(NSString *)thePatch toLocation:(NSString *)endLocationFile inWorkingDirectory:(NSString *)theDir;
+ (int)gunzip:(NSString *)inputFile;
+ (BOOL)hasFirmware;
+ (NSString *)firmwareFolder;
+ (BOOL)validateFile:(NSString *)inputFile withChecksum:(NSString *)checksum;
+ (float)sizeFreeOnMountedPath:(NSString *)theDevice;
+ (int)linkFile:(NSString *)theFile toPath:(NSString *)thePath inWorkingDirectory:(NSString *)theDir;
+ (int)bunZip:(NSString *)inputTar toRoot:(NSString *)toLocation excluding:(NSString *)excludeFile;
+ (int)extractGZip:(NSString *)inputTar toRoot:(NSString *)toLocation;
+ (int)bunZip:(NSString *)inputTar toRoot:(NSString *)toLocation;
+ (int)extractGZip:(NSString *)inputTar toLocation:(NSString *)toLocation;
+ (BOOL)unzipFile:(NSString *)theFile toPath:(NSString *)newPath;
+ (int)extractTar:(NSString *)inputTar toLocation:(NSString *)toLocation;
+ (NSDictionary *)fsImageInfo:(NSString *)inputFilesystem;
- (NSString *)filesystemResizeValue:(NSString *)inputFilesystem;
- (NSString *)ramdiskResizeValue:(NSString *)inputRD;
+ (int)mountImageSimple:(NSString *)irString;
+ (void)unmountVolume:(NSString *)theVolume;
+ (NSString *)mountImage:(NSString *)irString;
+ (BOOL)checkFile:(NSString *)inputFile againstMD5:(NSString *)properMD5;
+ (int)scanForRestore:(NSString *)drivepath;
+ (int)resizeVolume:(NSString *)theVolume toSize:(NSString *)theSize;
+ (void)altValidateFile:(NSString *)inputFile withChecksum:(NSString *)checksum;
+ (void)changeOwner:(NSString *)theOwner onFile:(NSString *)theFile isRecursive:(BOOL)isR;
+ (void)changePermissions:(NSString *)perms onFile:(NSString *)theFile isRecursive:(BOOL)isR;
//+ (int)cleanupRamdisk;
+ (int)patchFile:(NSString *)patchFile withPatch:(NSString *)thePatch endMD5:(NSString *)desiredMD5;
+ (int)decryptRamdisk:(NSString *)theRamdisk toPath:(NSString *)outputDisk withIV:(NSString *)iv key:(NSString *)key;
+ (int)repackRamdisk:(NSString *)theRamdisk toPath:(NSString *)outputDisk withIV:(NSString *)iv key:(NSString *)key originalPath:(NSString *)original;
+ (int)decryptFilesystem:(NSString *)fileSystem withKey:(NSString *)fileSystemKey;
+ (NSString *)convertImage:(NSString *)irString toFile:(NSString *)outputFile toMode:(int)theMode;
+ (int)patchIBSS:(NSString *)ibssFile;
- (void)patchFilesystem:(NSString *)inputFilesystem;
- (NSString *)pwnctionaryFromPath:(NSString *)mountedPath original:(NSString *)original withBundle:(FWBundle *)theBundle;
- (void)permissionedPatch:(NSString *)theFile withOriginal:(NSString *)originalDMG;
+ (int)migrateFiles:(NSArray *)migration toPath:(NSString *)finalPath;
+ (void)createTempSetup;
- (int)patchRamdisk:(NSString *)theRamdisk;
+ (int)runScript:(NSString *)theScript withInput:(NSString *)theInput;
+ (int)createIPSWToFile:(NSString *)theName;
+(int)decryptedPatchFromData:(NSDictionary *)patchData atRoot:(NSString *)rootPath fromBundle:(NSString *)bundlePath;
- (int)performPatchesFromBundle:(FWBundle *)theBundle onRamdisk:(NSDictionary *)ramdiskDict;
+(int)decryptImage:(NSString *)theImage toPath:(NSString *)finalPath withIV:(NSString *)iv key:(NSString *)key;
+(int)decryptedImageFromData:(NSDictionary *)patchData atRoot:(NSString *)rootPath fromBundle:(NSString *)bundlePath;
+ (NSString *)applicationSupportFolder;
@end