Skip to content

Commit 2dd4821

Browse files
committed
1.4-git9 - fixes cracked updated apps bug
1 parent 196ddd8 commit 2dd4821

File tree

9 files changed

+52
-22
lines changed

9 files changed

+52
-22
lines changed

Classes/Application.m

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ - (id)initWithAppInfo:(NSDictionary *)info
5252
dictRep = copy;
5353
isCracking = NO;
5454
_info = info;
55+
5556
}
5657
return self;
5758
}

Classes/ApplicationLister.h

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
- (NSArray *)crackedApps;
1717
- (void)saveModifiedAppsCache;
1818
- (NSArray *)modifiedApps;
19+
-(void)crackedApp:(Application*) app;
1920
@end

Classes/ApplicationLister.m

+29-12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#import "Preferences.h"
1313

1414
#define applistCachePath @"/etc/applist-cache.clutch"
15+
#define crackedAppPath @"/etc/cracked.clutch"
1516

1617
NSArray * get_application_list(BOOL sort) {
1718

@@ -68,7 +69,7 @@
6869
@"ApplicationBasename":[appPath lastPathComponent],
6970
@"ApplicationVersion":version,
7071
@"ApplicationBundleID":bundleID,
71-
@"ApplicationSINF":SINF,
72+
//@"ApplicationSINF":SINF,
7273
@"ApplicationExecutableName":executableName,
7374
@"MinimumOSVersion":minimumOSVersion}];
7475

@@ -129,24 +130,40 @@ + (instancetype)sharedInstance
129130
}
130131

131132
- (NSArray *)modifiedApps {
132-
NSArray* cache = [self modifiedAppCache];
133+
NSDictionary* cracked = [self crackedAppsList];
133134
NSArray* apps = get_application_list(YES);
134135
NSMutableArray* modifiedApps = [[NSMutableArray alloc] init];
135-
for (Application* oldApp in cache) {
136-
for (Application* newApp in apps) {
137-
if ([oldApp.applicationBundleID isEqualToString:newApp.applicationBundleID]) {
138-
DEBUG(@"same bundle id deteced! %@", newApp.applicationBundleID);
139-
if (newApp.appVersion != oldApp.appVersion) {
140-
[modifiedApps addObject:newApp];
141-
142-
}
143-
144-
}
136+
for (Application* app in apps) {
137+
NSDictionary* appInfo = [cracked objectForKey:app.applicationBundleID];
138+
if (appInfo == nil) {
139+
continue;
140+
}
141+
Application* oldApp = [[Application alloc] initWithAppInfo:appInfo];
142+
DEBUG(@"new app version: %ld, %ld", (long)oldApp.appVersion, (long)app.appVersion);
143+
if (app.appVersion > oldApp.appVersion) {
144+
[modifiedApps addObject:app];
145145
}
146146
}
147+
DEBUG(@"modified apps array %@", modifiedApps);
147148
return modifiedApps;
148149
}
149150

151+
-(void)crackedApp:(Application*) app {
152+
DEBUG(@"cracked app ok");
153+
DEBUG(@"this crack lol %ld", (long)app.appVersion);
154+
NSMutableDictionary* dict = [[NSMutableDictionary alloc] initWithDictionary:[self crackedAppsList]];
155+
if (dict == nil) {
156+
dict = [[NSMutableDictionary alloc] init];
157+
}
158+
[dict setObject:app.dictionaryRepresentation forKey:app.applicationBundleID];
159+
DEBUG(@"da dict %@", dict);
160+
[dict writeToFile:crackedAppPath atomically:YES];
161+
}
162+
163+
-(NSDictionary*)crackedAppsList {
164+
return [[NSDictionary alloc] initWithContentsOfFile:crackedAppPath];
165+
}
166+
150167
-(void)saveModifiedAppsCache {
151168
get_application_list(YES);
152169
}

Classes/Constants.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
#define CLUTCH_TITLE "Clutch"
2828
#define CLUTCH_VERSION "1.4"
29-
#define CLUTCH_RELEASE "git-8"
30-
#define CLUTCH_BUILD 14008
29+
#define CLUTCH_RELEASE "git-9"
30+
#define CLUTCH_BUILD 14009
3131
#define CLUTCH_DEV 1
3232

3333
void sha1(uint8_t *hash, uint8_t *data, size_t size);

Classes/Cracker.m

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "API.h"
1212
#import "YOPAPackage.h"
1313
#import "Localization.h"
14+
#import "ApplicationLister.h"
1415

1516
#import <xpc/xpc.h>
1617
// ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/xpc /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/xpc
@@ -366,6 +367,10 @@ -(BOOL) execute
366367

367368
DEBUG(@"------End Execute Crack------");
368369

370+
[[ApplicationLister sharedInstance] crackedApp:_app];
371+
372+
DEBUG(@"Saved cracked app info!");
373+
369374
return crackOk;
370375
}
371376

Classes/izip.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ - (void) zipCracked
158158
{
159159
// Only add it if it's not a directory. ZipArchive will take care of those.
160160
NSString *longPath = [_cracker->_tempPath stringByAppendingPathComponent:path];
161-
NSLog(@"longpath %@ %@", longPath, path);
161+
//NSLog(@"longpath %@ %@", longPath, path);
162162

163163
if([fileManager fileExistsAtPath:longPath isDirectory:&isDir] && !isDir)
164164
{
165-
DEBUG(@"adding file %@", longPath);
165+
//DEBUG(@"adding file %@", longPath);
166166
[_archiver addFileToZip:longPath newname:path compressionLevel:compressionLevel];
167167
}
168168
}
169-
DEBUG(@"subpaths %@", subpaths);
169+
//DEBUG(@"subpaths %@", subpaths);
170170
return;
171171
}
172172
- (void) setCompressionLevel:(int) level

Classes/main.m

+9-3
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ void cmd_list_applications(NSArray *applications)
213213

214214
int cmd_crack_all(NSArray *applications)
215215
{
216-
MSG(CLUTCH_CRACKING_ALL);
217-
218216
NSString *ipapath;
219217

220218
for (Application* app in applications) {
@@ -262,6 +260,7 @@ int cmd_crack_app(Application *app, int yopa_enabled)
262260
{
263261
gettimeofday(&end, NULL);
264262

263+
265264
crack = TRUE;
266265

267266
printf("\t%s\n", [ipapath UTF8String]);
@@ -393,6 +392,7 @@ int main(int argc, char *argv[])
393392
{
394393
applist = [[ApplicationLister sharedInstance] installedApps];
395394
retVal = cmd_crack_all(applist);
395+
MSG(CLUTCH_CRACKING_ALL);
396396
}
397397
else if ([arg isEqualToString:@"-f"] || [arg isEqualToString:@"-flush"])
398398
{
@@ -418,8 +418,14 @@ int main(int argc, char *argv[])
418418
{
419419
//get updated apps only
420420
applist = [[ApplicationLister sharedInstance] modifiedApps];
421-
printf("\n cracking all updated apps!\n");
421+
if ([applist count] == 0) {
422+
printf("You have no updated apps!\n");
423+
retVal = 0;
424+
goto endMain;
425+
}
426+
printf("Cracking all updated apps!\n");
422427
retVal = cmd_crack_all(applist);
428+
goto endMain;
423429
}
424430
else if ([arg isEqualToString:@"-h"] || [arg isEqualToString:@"-help"])
425431
{

Resources/Clutch-Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>1.3</string>
22+
<string>1.4</string>
2323
<key>CFBundleSignature</key>
2424
<string>????</string>
2525
<key>CFBundleVersion</key>
26-
<string>1.0</string>
26+
<string>9</string>
2727
<key>LSRequiresIPhoneOS</key>
2828
<true/>
2929
<key>NSMainNibFile</key>

0 commit comments

Comments
 (0)