Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed double binary issue

  • Loading branch information...
commit f4aa85e7efe3644c4abb3ef69db7796f5cfb6002 1 parent 6b22297
@ttwj authored
View
2  Classes/zip/ZipArchive.h
@@ -36,6 +36,8 @@
@property (nonatomic, retain) id delegate;
+-(BOOL) openZipFile2:(NSString*) zipFile;
+
-(BOOL) CreateZipFile2:(NSString*) zipFile;
-(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password;
-(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname compression:(int) compression;
View
8 Classes/zip/ZipArchive.mm
@@ -331,6 +331,14 @@ -(NSDate*) Date1980
return date;
}
+-(BOOL) openZipFile2:(NSString*) zipFile
+{
+ _zipFile = zipOpen( (const char*)[zipFile UTF8String], 2);
+ if( !_zipFile )
+ return NO;
+ return YES;
+}
+
@end
View
8 README.md
@@ -1 +1,9 @@
*Clutch* is a cracking utility for the iPhone, iPod Touch and iPad.
+
+
+
+Compiling
+---------------
+1. open xcode
+2. compile
+3. sign entitlements properly
View
23 crack.m
@@ -2,6 +2,7 @@
#import <Foundation/Foundation.h>
#import "NSTask.h"
#import "ZipArchive.h"
+#include <sys/stat.h>
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
@@ -16,6 +17,13 @@
int compression_level = -1;
+long fsize(const char *file) {
+ struct stat st;
+ if (stat(file, &st) == 0)
+ return st.st_size;
+
+ return -1;
+}
ZipArchive * createZip(NSString *file) {
ZipArchive *archiver = [[ZipArchive alloc] init];
[archiver CreateZipFile2:file];
@@ -45,7 +53,8 @@ void zip(ZipArchive *archiver, NSString *folder) {
return;
}
-void zip_original(ZipArchive *archiver, NSString *folder, NSString *binary) {
+void zip_original(ZipArchive *archiver, NSString *folder, NSString *binary, NSString* zip) {
+ long size;
BOOL isDir=NO;
NSArray *subpaths;
int total = 0;
@@ -59,11 +68,19 @@ void zip_original(ZipArchive *archiver, NSString *folder, NSString *binary) {
for(NSString *path in subpaths) {
togo--;
- if (([path rangeOfString:@".app"].location != NSNotFound) && ([path rangeOfString:@"SC_Info"].location == NSNotFound) && ([path rangeOfString:@"Library"].location == NSNotFound) && ([path rangeOfString:@"tmp"].location == NSNotFound)) {
+ if (([path rangeOfString:@".app"].location != NSNotFound) && ([path rangeOfString:@"SC_Info"].location == NSNotFound) && ([path rangeOfString:@"Library"].location == NSNotFound) && ([path rangeOfString:@"tmp"].location == NSNotFound) && ([path rangeOfString:[NSString stringWithFormat:@".app/%@", binary]].location == NSNotFound)) {
PERCENT((int)ceil((((double)total - togo) / (double)total) * 100));
// Only add it if it's not a directory. ZipArchive will take care of those.
NSString *longPath = [folder stringByAppendingPathComponent:path];
if([fileManager fileExistsAtPath:longPath isDirectory:&isDir] && !isDir){
+ size += fsize([longPath UTF8String]);
+ if (size > 31457280){
+ VERBOSE("Zip went over 30MB, saving..");
+ [archiver CloseZipFile2];
+ [archiver release];
+ archiver = [[ZipArchive alloc] init];
+ [archiver openZipFile2:zip];
+ }
[archiver addFileToZip:longPath newname:[NSString stringWithFormat:@"Payload/%@", path] compression:compression_level];
}
}
@@ -294,7 +311,7 @@ void zip_original(ZipArchive *archiver, NSString *folder, NSString *binary) {
NOTIFY("Compressing original application (1/2)...");
ZipArchive *archiver = [[ZipArchive alloc] init];
[archiver CreateZipFile2:ipapath];
- zip_original(archiver, [application_basedir stringByAppendingString:@"../"], binary_name);
+ zip_original(archiver, [application_basedir stringByAppendingString:@"../"], binary_name, ipapath);
stop_bar();
NOTIFY("Compressing cracked application (2/2)..");
Please sign in to comment.
Something went wrong with that request. Please try again.