Skip to content

Instantly share code, notes, and snippets.

@reyder
Forked from ericbroska/AntiReceigenSec.m
Created October 3, 2013 22:13
Show Gist options
  • Save reyder/6817934 to your computer and use it in GitHub Desktop.
Save reyder/6817934 to your computer and use it in GitHub Desktop.
// @ericbroska
// Fake Security dylib that makes Receigen suck
//
// Usage:
// ----------------------
// 1) compile this file:
// $ clang -dynamiclib -current_version 1.0.0 -compatibility_version 1.0.0 -Wl,-init,_m__n -framework Cocoa -framework Security -lcrypto -o .fakefakefakefakefakesecurity.dylib AntiReceigenSec.m
//
// 2) copy the generated «.fakefakefakefakefakesecurity.dylib» to, say, ./Target.app/Contents/Resources/
// (yes, you can choose any other path inside a target application's bunlde);
//
// 3) open the app's executable, search and replace string
// /System/Library/Frameworks/Security.framework/Versions/A/Security
// with
// @executable_path/../Resources/.fakefakefakefakefakesecurity.dylib
//
// 4) codesign the app
//
// 5) profit goes here!
#import <Cocoa/Cocoa.h>
#include <Security/SecAsn1Types.h>
// A target app expects us to export these sybols
const SecAsn1Template kSecAsn1IA5StringTemplate[] = { 'C', 'N', 'C' };
const SecAsn1Template kSecAsn1IntegerTemplate[] = { 'h', 'a', 's' };
const SecAsn1Template kSecAsn1UTF8StringTemplate[] = { 'y', 'o', 'u' };
int m__n(void)
{
return NSApplicationMain(0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment