Skip to content

Commit

Permalink
A heck of a lot of changes!
Browse files Browse the repository at this point in the history
Full UI implemented, background automated signing via daemon, etc.
  • Loading branch information
Matchstic committed Jul 8, 2018
1 parent 2ea565f commit 6c31fde
Show file tree
Hide file tree
Showing 270 changed files with 5,946 additions and 1,759 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Working/
.theos/
reddit_post.md
Screenshots/
Packages/
iOS/CydiaPackages/
Pods/
Podfile.lock

Expand Down
Binary file added Icons/Credits/Author.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/Credits/Author@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/Credits/Author@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/Credits/Designer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/Credits/Designer@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/Credits/Designer@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_20pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_20pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_20pt@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_29pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_29pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_29pt@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_40pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_40pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_40pt@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_60pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_60pt@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_76pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_76pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/Color BG/icon_83.5@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_20pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_20pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_20pt@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_29pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_29pt@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icons/iOS App Icon/White BG/icon_29pt@3x.png
Binary file added Icons/iOS App Icon/White BG/icon_40pt.png
Binary file added Icons/iOS App Icon/White BG/icon_40pt@2x.png
Binary file added Icons/iOS App Icon/White BG/icon_40pt@3x.png
Binary file added Icons/iOS App Icon/White BG/icon_60pt@2x.png
Binary file added Icons/iOS App Icon/White BG/icon_60pt@3x.png
Binary file added Icons/iOS App Icon/White BG/icon_76pt.png
Binary file added Icons/iOS App Icon/White BG/icon_76pt@2x.png
Binary file added Icons/iOS App Icon/White BG/icon_83.5@2x.png
Binary file added Icons/iOS Tab Bar/Installed Active.png
Binary file added Icons/iOS Tab Bar/Installed Active@2x.png
Binary file added Icons/iOS Tab Bar/Installed Active@3x.png
Binary file added Icons/iOS Tab Bar/Installed.png
Binary file added Icons/iOS Tab Bar/Installed@2x.png
Binary file added Icons/iOS Tab Bar/Installed@3x.png
Binary file added Icons/iOS Tab Bar/Settings Active.png
Binary file added Icons/iOS Tab Bar/Settings Active@2x.png
Binary file added Icons/iOS Tab Bar/Settings Active@3x.png
Binary file added Icons/iOS Tab Bar/Settings.png
Binary file added Icons/iOS Tab Bar/Settings@2x.png
Binary file added Icons/iOS Tab Bar/Settings@3x.png
Binary file added Icons/iOS Tab Bar/Troubleshooting Active.png
Binary file added Icons/iOS Tab Bar/Troubleshooting Active@2x.png
Binary file added Icons/iOS Tab Bar/Troubleshooting Active@3x.png
Binary file added Icons/iOS Tab Bar/Troubleshooting.png
Binary file added Icons/iOS Tab Bar/Troubleshooting@2x.png
Binary file added Icons/iOS Tab Bar/Troubleshooting@3x.png
5 changes: 5 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
target 'iOS' do
platform :ios, '9.0'
pod 'OpenSSL-Universal'
pod "MBCircularProgressBar"
pod 'MarqueeLabel'
pod 'TORoundedTableView'
end

target 'macOS' do
platform :osx, '10.10'
pod 'OpenSSL-Universal'
end
512 changes: 411 additions & 101 deletions ReProvision.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions Shared/Application Database/RPVApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (UIImage*)applicationIcon {
UIImage *icon;

if (self.proxy != nil) {
icon = [UIImage _applicationIconImageForBundleIdentifier:[self bundleIdentifier] format:0 scale:[UIScreen mainScreen].scale];
icon = [UIImage _applicationIconImageForBundleIdentifier:[self bundleIdentifier] format:2 scale:[UIScreen mainScreen].scale];
} else {
icon = [UIImage imageNamed:@"AppIcon40x40"];
}
Expand All @@ -65,9 +65,14 @@ - (NSDate*)applicationExpiryDate {
return [NSDate dateWithTimeIntervalSinceNow:172800];
}

//LSApplicationProxy *proxy = [LSApplicationProxy applicationProxyForIdentifier:[self bundleIdentifier]];
NSString *provisionPath = [[self.proxy.bundleURL path] stringByAppendingString:@"/embedded.mobileprovision"];

if (![[NSFileManager defaultManager] fileExistsAtPath:provisionPath]) {
NSLog(@"*** [ReProvision] :: ERROR :: No embedded.mobileprovision at %@, given bundleURL is %@", provisionPath, self.proxy.bundleURL);

// Date that is 2 days away.
return [NSDate dateWithTimeIntervalSinceNow:172800];
}

NSDictionary *provision = [self _provisioningProfileAtPath:provisionPath];

return [provision objectForKey:@"ExpirationDate"];
Expand Down
11 changes: 11 additions & 0 deletions Shared/Application Database/RPVApplicationDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import <Foundation/Foundation.h>

@class RPVApplication;

@interface RPVApplicationDatabase : NSObject

/**
Expand All @@ -21,6 +23,13 @@
*/
- (NSArray*)getAllApplicationsForTeamID:(NSString*)teamID;

/**
Creates a new RPVApplication object for the given bundle identifier.
@param bundleIdentifier Bundle identifier of the application
@return New abstract object for the application.
*/
- (RPVApplication*)getApplicationWithBundleIdentifier:(NSString*)bundleIdentifier;

/**
beforeApplications will end up containing all applications that expire before the given date, and
afterApplications has those expiring after the given date.
Expand All @@ -36,4 +45,6 @@
*/
- (BOOL)getApplicationsWithExpiryDateBefore:(NSMutableArray**)beforeApplications andAfter:(NSMutableArray**)afterApplications date:(NSDate*)cutoffDate forTeamID:(NSString*)teamID;

- (NSArray*)getAllSideloadedApplicationsNotMatchingTeamID:(NSString*)teamID;

@end
52 changes: 52 additions & 0 deletions Shared/Application Database/RPVApplicationDatabase.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ @interface LSApplicationProxy : NSObject
@property (nonatomic, readonly) NSString *teamID;
@property (nonatomic, readonly) NSString *applicationIdentifier;
@property (nonatomic, readonly) NSURL *bundleURL;
@property (nonatomic, readonly) BOOL isAdHocCodeSigned;
+ (instancetype)applicationProxyForIdentifier:(NSString*)arg1;
@end

Expand Down Expand Up @@ -65,6 +66,57 @@ - (NSArray*)getAllApplicationsForTeamID:(NSString*)teamID {
return [self _retrieveAllApplicationsForTeamID:teamID];
}

- (RPVApplication*)getApplicationWithBundleIdentifier:(NSString*)bundleIdentifier {
LSApplicationProxy *proxy = [LSApplicationProxy applicationProxyForIdentifier:bundleIdentifier];
return [[RPVApplication alloc] initWithApplicationProxy:proxy];
}

- (NSArray*)getAllSideloadedApplicationsNotMatchingTeamID:(NSString*)teamID {
NSMutableArray *applications = [NSMutableArray array];

// Parse the currently installed profiles.
// If the profile has a non-matching Team ID, perfect.

for (LSApplicationProxy *proxy in [[LSApplicationWorkspace defaultWorkspace] allApplications]) {
if (![[proxy teamID] isEqualToString:@"0000000000"]) {
// First sanity check passed for system apps, check for embedded profile.

NSString *provisionPath = [[proxy.bundleURL path] stringByAppendingString:@"/embedded.mobileprovision"];

if ([[NSFileManager defaultManager] fileExistsAtPath:provisionPath]) {
// Yep, definitely sideloaded!

// Load profile from disk.
NSError *err;
NSString *stringContent = [NSString stringWithContentsOfFile:provisionPath encoding:NSASCIIStringEncoding error:&err];
stringContent = [stringContent componentsSeparatedByString:@"<plist version=\"1.0\">"][1];
stringContent = [NSString stringWithFormat:@"%@%@", @"<plist version=\"1.0\">", stringContent];
stringContent = [stringContent componentsSeparatedByString:@"</plist>"][0];
stringContent = [NSString stringWithFormat:@"%@%@", stringContent, @"</plist>"];

NSData *stringData = [stringContent dataUsingEncoding:NSASCIIStringEncoding];

NSError *error;
NSPropertyListFormat format;

NSDictionary *plist = [NSPropertyListSerialization propertyListWithData:stringData options:NSPropertyListImmutable format:&format error:&error];

// Check Team ID.
NSString *teamIDToCheck = [[plist objectForKey:@"TeamIdentifier"] firstObject];

if (![teamIDToCheck isEqualToString:teamID]) {
// Success!
RPVApplication *application = [[RPVApplication alloc] initWithApplicationProxy:proxy];

[applications addObject:application];
}
}
}
}

return applications;
}

/**
beforeApplications will end up containing all applications that expire before the given date, and
afterApplications has those expiring after the given date.
Expand Down
34 changes: 30 additions & 4 deletions Shared/Application Database/RPVApplicationSigning.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@
#import <Foundation/Foundation.h>
#import "RPVErrors.h"

@protocol RPVApplicationSigningProtocol <NSObject>

/**
Called when application signing is begun
*/
- (void)applicationSigningDidStart;

/**
Called when progress is made on the re-signing pipeline for a given bundle identifier. arg0 is the bundle identifier, and arg1 is the progress in percent (0-100)
*/
- (void)applicationSigningUpdateProgress:(int)progress forBundleIdentifier:(NSString*)bundleIdentifier;

/**
Called when an error occurs for a single application's pipeline.
*/
- (void)applicationSigningDidEncounterError:(NSError*)error forBundleIdentifier:(NSString*)bundleIdentifier;

/**
Called when the pipeline is finished for all applications.
*/
- (void)applicationSigningCompleteWithError:(NSError*)error;
@end

@interface RPVApplicationSigning : NSObject

+ (instancetype)sharedInstance;
Expand All @@ -23,10 +46,13 @@
@param teamID The user's Team ID to generate a list of on-device applications that are applicable to be re-signed.
@param username The user's username to authenticate with Apple's Developer Portal
@param password The user's password to authenticate with Apple's Developer Portal
@param progressUpdateHandler Called when progress is made on the re-signing pipeline for a given bundle identifier. arg0 is the bundle identifier, and arg1 is the progress in percent (0-100)
@param errorHandler Called when an error occurs for a single application's pipeline.
@param completionHandler Called when the pipeline is finished for all applications.
*/
- (void)resignApplications:(BOOL)onlyExpiringApplications thresholdForExpiration:(int)thresholdForExpiration withTeamID:(NSString*)teamID username:(NSString*)username password:(NSString*)password progressUpdateHandler:(void (^)(NSString*, int))progressUpdateHandler errorHandler:(void (^)(NSError*, NSString*))errorHandler andCompletionHandler:(void (^)(NSError*))completionHandler;
- (void)resignApplications:(BOOL)onlyExpiringApplications thresholdForExpiration:(int)thresholdForExpiration withTeamID:(NSString*)teamID username:(NSString*)username password:(NSString*)password;

- (void)resignSpecificApplications:(NSArray*)applications withTeamID:(NSString*)teamID username:(NSString*)username password:(NSString*)password;

- (void)addSigningUpdatesObserver:(id<RPVApplicationSigningProtocol>)observer;

- (void)removeSigningUpdatesObserver:(id<RPVApplicationSigningProtocol>)observer;

@end
Loading

0 comments on commit 6c31fde

Please sign in to comment.