Skip to content

Commit 2e2e49d

Browse files
committed
Implemented re-scanning
1 parent b611060 commit 2e2e49d

6 files changed

Lines changed: 34 additions & 14 deletions

File tree

securOS/Storyboards/Base.lproj/Main.storyboard

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ YouTube: iDevice Central</string>
108108
<fontDescription key="fontDescription" name="Futura-Medium" family="Futura" pointSize="17"/>
109109
<state key="normal" title="Perform iSecureOS Scan" backgroundImage="button_mask"/>
110110
<connections>
111-
<segue destination="01f-sZ-FeH" kind="presentation" modalPresentationStyle="fullScreen" id="c3R-bq-Pxr"/>
111+
<action selector="performScanNow:" destination="BYZ-38-t0r" eventType="touchUpInside" id="jKq-hC-GYx"/>
112112
</connections>
113113
</button>
114114
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="infoDark" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="v2z-Ik-Lma">
@@ -203,10 +203,10 @@ YouTube: iDevice Central</string>
203203
</objects>
204204
<point key="canvasLocation" x="133.59999999999999" y="116.49175412293854"/>
205205
</scene>
206-
<!--SecuriOS Logging-->
206+
<!--ScanView-->
207207
<scene sceneID="uAH-On-fBx">
208208
<objects>
209-
<viewController id="01f-sZ-FeH" customClass="securiOS_Logging" sceneMemberID="viewController">
209+
<viewController storyboardIdentifier="SscanView" title="ScanView" useStoryboardIdentifierAsRestorationIdentifier="YES" id="01f-sZ-FeH" customClass="securiOS_Logging" sceneMemberID="viewController">
210210
<view key="view" contentMode="scaleToFill" id="uXP-yS-OWE">
211211
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
212212
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

securOS/iSecureOS-Core/iSecureOS-Core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ NS_ASSUME_NONNULL_BEGIN
2121
@property (weak, nonatomic) IBOutlet UIButton *backButton12;
2222
@property (weak, nonatomic) IBOutlet UITextView *logmeeh;
2323
@property (weak, nonatomic) IBOutlet UILabel *currentFile;
24-
24+
void respringDeviceNow(void);
2525
@end
2626
NS_ASSUME_NONNULL_END

securOS/iSecureOS-Core/iSecureOS-Core.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,12 @@ - (void) dismissKeyboard {
190190

191191
int populateVulnerableReposFromSignatures() {
192192
SecurityRiskRepos = [[NSMutableArray alloc] init];
193-
NSString *textFilePath = @"/var/mobile/iSecureOS/repo-signatures";
194-
NSError *error;
195-
NSString *fileContentsUrls = [NSString stringWithContentsOfFile:textFilePath encoding:NSUTF8StringEncoding error:&error];
196-
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:fileContentsUrls options: NSDataBase64DecodingIgnoreUnknownCharacters];
197-
NSString *base64DecodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
193+
NSString *repoDefinitionsPath = @"/var/mobile/iSecureOS/repo-signatures";
194+
NSError *repoFileErr;
195+
NSString *fileContentsUrls = [NSString stringWithContentsOfFile:repoDefinitionsPath encoding:NSUTF8StringEncoding error: &repoFileErr];
196+
SecurityRiskRepos = [[fileContentsUrls componentsSeparatedByString:@"\n"] mutableCopy];
198197

199-
SecurityRiskRepos = [[base64DecodedString componentsSeparatedByString:@"\n"] mutableCopy];
200-
NSLog(@"%@", base64DecodedString);
201-
if (error == nil) {
198+
if (repoFileErr == nil) {
202199
printf("Successfully loaded Repo Signatures into iSecureOS\n");
203200
return 0;
204201
} else {
@@ -628,6 +625,7 @@ void performSuspectRepoScanning() {
628625
printf("[ i ] You do not seem to have problematic repos installed. GREAT!\n\n");
629626
}
630627
}
628+
631629
int execprog(const char *prog, const char* args[]) {
632630
if (args == NULL) {
633631
args = (const char **)&(const char*[]){ prog, NULL };
@@ -662,6 +660,12 @@ int execprog(const char *prog, const char* args[]) {
662660
return 0;
663661
}
664662

663+
void respringDeviceNow() {
664+
const char * arguments = "backboardd";
665+
execprog("killall", &arguments);
666+
return;
667+
}
668+
665669
int checkActiveSSHConnection() {
666670
// Check if an active root connection is found
667671
int rootAccess = warnaxActiveSSHConnection("sshd: root@ttys");

securOS/iSecureOS-Main/iSecureOS-Main.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,17 @@ - (BOOL) canAccessGitHubPages {
9595
return isConnected;
9696
}
9797

98+
- (IBAction)performScanNow:(id)sender {
99+
_currentStatus.text = @"You have never scanned.";
100+
_shieldStatus.image = [UIImage imageNamed: @"shielderr.png"];
101+
102+
dispatch_async(dispatch_get_main_queue(), ^{
103+
NSString * storyboardName = @"Main";
104+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
105+
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"ScanView"];
106+
[self presentViewController:vc animated:YES completion:nil];
107+
});
108+
[_secureOS_Load_Btn setTitle:@"Re-Scan" forState:UIControlStateNormal];
109+
}
110+
98111
@end

securOS/iSecureOS-Settings/iSecureOS-Settings.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <dirent.h>
1414
#include <sys/stat.h>
1515
#include <unistd.h>
16+
#include "iSecureOS-Core.h"
1617

1718
@interface iSecureOS_Settings ()
1819

@@ -168,8 +169,10 @@ - (IBAction)resetPasswordsAction:(id)sender {
168169
message:@"The SSH password for ROOT and MOBILE users has been reverted back to the default, alpine. Please do a scan with iSecureOS and change it to a new one that you will remember."
169170
preferredStyle:UIAlertControllerStyleAlert];
170171

171-
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Thank you" style:UIAlertActionStyleDefault
172-
handler:^(UIAlertAction * action) {}];
172+
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDefault
173+
handler:^(UIAlertAction * action) {
174+
respringDeviceNow();
175+
}];
173176

174177
[alert addAction:defaultAction];
175178
[self presentViewController:alert animated:YES completion:nil];

0 commit comments

Comments
 (0)