Skip to content

Commit

Permalink
Added intruder script to reset iOS app keychain
Browse files Browse the repository at this point in the history
  • Loading branch information
dpnishant committed Jul 14, 2017
1 parent 4c3db24 commit 95ad2d3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions intruder/scripts/iOS/resetKeychain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2016 Nishant Das Patnaik.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

'use strict';

var NSMutableDictionary = ObjC.classes.NSMutableDictionary;
var SecItemDelete_function = new NativeFunction(ptr(Module.findExportByName('Security', 'SecItemDelete')), 'pointer', ['pointer']);
var dict = NSMutableDictionary.alloc().init();

// Keychain item types to be queried e.g. kSecClassKey, kSecClassIdentity, kSecClassCertificate, kSecClassGenericPassword, kSecClassInternetPassword
var classes = ['class', 'keys', 'idnt', 'cert', 'genp', 'inet'];

try {
for (item_class_index in classes) {
var item_class = classes[item_class_index];
dict.setObject_forKey_(item_class, kSecClass); // set the class-type of the item being queried
SecItemDelete_function(dict); // delete the class's items.
}
} catch (e) {
console.log(e.stack);
}
console.log('[+] Keychain cleared!');

0 comments on commit 95ad2d3

Please sign in to comment.