Skip to content

Instantly share code, notes, and snippets.

0xc010d / ReCodeSign
Created November 14, 2011 22:38
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
- Copy the delivered ipa into a directory to work in.
- export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy
will need to be written as the full path.
- Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its
- Enter the command "codesign -d --entitlements :enterprise.plist Payload/" This pulls the entitlements out of the app, and
prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.
0xc010d / NSString+Mod97Check.h
Last active April 9, 2021 13:57
Objective-C implementation of mod97 IBAN checking algorithm
#import <Foundation/Foundation.h>
@interface NSString (Mod97Check)
- (BOOL)passesMod97Check; // Returns result of mod 97 checking algorithm. Might be used to check IBAN.
// Expects string to contain digits and/or upper-/lowercase letters; space and all the rest symbols are not acceptable.
import Foundation
import Security
private let keychainQueue = dispatch_queue_create("networking.keychain", DISPATCH_QUEUE_CONCURRENT)
public class Keychain {
private let service: String
public init(service: String) {
self.service = service
# Basic Strongswan ikev2 server setup
* paltform: ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
apt-get install strongswan
apt-get install iptables iptables-persistent
static __attribute__((always_inline)) CCCryptorStatus AES128Run(CCOperation operation, NSData *inData, NSData *key, NSData *__autoreleasing *outData) {
CCCryptorStatus status = kCCParamError;
if (outData != NULL) {
CCCryptorRef cryptor = NULL;
//correct key length
NSMutableData *correctedKey = [key mutableCopy];
if ([key length] <= kCCKeySizeAES128) {
[correctedKey setLength:kCCKeySizeAES128];
0xc010d / PackageApplication.patch
Created June 12, 2013 22:18
PackageApplication patch which allows keychain specifying for codesign
> "keychain|k=s",
> if ( $opt{keychain} ) {
> push(@codesign_args, '--keychain');
> push(@codesign_args, $opt{keychain});
> }
< PackageApplication [-s signature] application [-o output_directory] [-verbose] [-plugin plugin] || -man || -help
0xc010d / gist:5201458
Created March 20, 2013 00:44
Self-executable .m file
/*/../bin/ls > /dev/null
clang $0 -o $COMPILED -framework Foundation;
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
0xc010d / gist:5134242
Last active December 14, 2015 19:09
curl | gcc -framework Foundation -framework Security -o /usr/local/bin/mobileprovision-read -x objective-c -
#import <Foundation/Foundation.h>
#import <Security/Security.h>
int main(int argc, const char *argv[]) {
NSUserDefaults *arguments = [NSUserDefaults standardUserDefaults];
NSString *file = [arguments stringForKey:@"f"];
NSString *option = [arguments stringForKey:@"o"];
if (!file) {
0xc010d / Insert
Created March 5, 2013 23:58
Insert call
doc = Document.getCurrentDocument()
seg = doc.getCurrentSegment()
adr = doc.getCurrentAddress()
dstStr = Document.ask("Enter destination address:")
if dstStr != None:
dst = int(dstStr, 16)
offset = dst - (adr + 6)
after = adr + 6
while seg.getTypeAtAddress(after) == Segment.TYPE_NEXT:
after = after + 1
0xc010d / Insert mov rsi, <address>.py
Created March 5, 2013 23:58
Insert mov rsi, <address>
# This sample script will search for the standard pattern that
# identifies a function's prolog, and mark each of them as a procedure
doc = Document.getCurrentDocument()
# First, we disassemble the whole segment
seg = doc.getCurrentSegment()
addr = seg.getStartingAddress()