Skip to content

Instantly share code, notes, and snippets.

@smirn0v
smirn0v / msg send nil self
Created April 30, 2013 20:30
ObjcMsgSend
// message sent to nil: redirect to nil receiver, if any
LMsgSendNilSelf:
call 1f // load new receiver
1: popl %edx
movl __objc_nilReceiver-1b(%edx),%eax
testl %eax, %eax // return nil if no new receiver
je LMsgSendReturnZero
movl %eax, self(%esp) // send to new receiver
jmp LMsgSendReceiverOk // receiver must be in %eax
@smirn0v
smirn0v / nil-receiver
Created April 30, 2013 20:38
alternative nil receiver
#include <Foundation/Foundation.h>
extern id _objc_setNilReceiver(id newNilReceiver);
@interface Foo:NSObject{}
@end
@implementation Foo
- (void) some {
NSLog(@"Some");
}
@smirn0v
smirn0v / gist:5814474
Created June 19, 2013 13:50
inseatd of sed
perl -pe "s/some/some2/g"
@smirn0v
smirn0v / gist:5845786
Created June 23, 2013 17:24
Demangle
$ c++filt __ZNKSs16find_last_not_ofEcm
std::string::find_last_not_of(char, unsigned long) const
def a(addr):
... print "0x%x"%(addr-0x1000+0x51000)
@smirn0v
smirn0v / gist:6000265
Created July 15, 2013 14:16
download ssl cert
echo "HEAD / HTTP/1.0\n Host: example.com:443\n\n EOT\n" | openssl s_client -prexit -connect example.com:443
@smirn0v
smirn0v / gist:6122949
Created July 31, 2013 15:23
clang build test from console
clang -framework Foundation -fobjc-arc test.m
sudo /usr/sbin/DevToolsSecurity --enable
@smirn0v
smirn0v / gist:6172658
Created August 7, 2013 09:42
Alternate xcodebuild
export DEVELOPER_DIR="/Users/johann/XcodesFolder/Xcode_4_6_3/Xcode.app/Contents/Developer";
@smirn0v
smirn0v / gist:6425865
Last active December 23, 2015 10:44
Resign
1. extract old entitlements
codesign -d --entitlements :entitlements.plist Payload/PathToApp.app/
2. fix entitlements, or just copy from provisioning profile
3. copy new provprofile to Payload/PathToApp.app/embedded.mobileprovision
4. fix bundle id in info.plist
4.1 /usr/libexec/PlistBuddy Info.plist
4.2 set CFBundleIdentifier new.app.bundle.id.with.no.team.id
4.3 save