Skip to content

Instantly share code, notes, and snippets.

@lyonanderson
Created February 26, 2015 16:42
Show Gist options
  • Save lyonanderson/5b8cc605be1c56b88978 to your computer and use it in GitHub Desktop.
Save lyonanderson/5b8cc605be1c56b88978 to your computer and use it in GitHub Desktop.
Cycript to listen to XPC Messages being created
@import com.saurik.substrate.MS
var log = []
NSLog_ = dlsym(RTLD_DEFAULT, "NSLog")
NSLog = function() { var types = 'v', args = [], count = arguments.length; for (var i = 0; i != count; ++i) { types += '@'; args.push(arguments[i]); } new Functor(NSLog_, types).apply(null, args); }
_CFXPCCreateXPCMessageWithCFObject = dlsym(RTLD_DEFAULT, "_CFXPCCreateXPCMessageWithCFObject");
_CFXPCCreateXPCMessageWithCFObject = @encode(void *(NSDictionary * object))(_CFXPCCreateXPCMessageWithCFObject)
_CFXPCCreateXPCMessageWithCFObject_Old ={}
MS.hookFunction(_CFXPCCreateXPCMessageWithCFObject, function(object) {var result = (*_CFXPCCreateXPCMessageWithCFObject_Old )(object); log.push(object); NSLog("Object>>: " + object); return result}, _CFXPCCreateXPCMessageWithCFObject_Old)
_CFXPCCreateCFObjectFromXPCMessage = dlsym(RTLD_DEFAULT, "_CFXPCCreateCFObjectFromXPCMessage");
_CFXPCCreateCFObjectFromXPCMessage = @encode(NSDictionary *(void * object))(_CFXPCCreateCFObjectFromXPCMessage);
_CFXPCCreateCFObjectFromXPCMessage_Old ={}
MS.hookFunction(_CFXPCCreateCFObjectFromXPCMessage, function(object) {var result = (*_CFXPCCreateCFObjectFromXPCMessage_Old )(object); log.push(object); NSLog("Object<<: " + object); return result}, _CFXPCCreateCFObjectFromXPCMessage_Old)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment