A lightweight cross-process communication tool for sending and receiving messages on iOS 15 & 16 for rootless jailbreaks
- Send Messages : Send a message with a value to another process .
- Send Messages With Reply : Send a message with a value to other processes and get an instant reply from those processes .
This tool relies on the CFNotificationCenterGetDistributedCenter()
function from macOS. It is also compatible with iOS. The primary functionality of this func is to send cross-process notifications.
Given the restrictions on CPDistributedMessagingCenter
, I have implemented its methods using the CFNotificationCenterGetDistributedCenter()
function. This approach ensures that cross-process communication is possible even under the limitations imposed by the platform.
By leveraging this functionality, developers can efficiently send notifications across different processes, enhancing the IPC
capabilities of their tweaks.
typedef enum CrossOverIPCServiceType : CFIndex {
SERVICE_TYPE_SENDER,
SERVICE_TYPE_LISTENER
} CrossOverIPCServiceType;
@interface CrossOverIPC : NSObject
+ (instancetype) centerNamed:(NSString *)serviceName type:(CrossOverIPCServiceType)type;
- (void) registerForMessageName:(NSString *)msgName target:(id)target selector:(SEL)sel;
- (void) sendMessageName:(NSString *)msgName userInfo:(NSDictionary *)userInfo;
- (NSDictionary *) sendMessageAndReceiveReplyName:(NSString *)msgName userInfo:(NSDictionary *)userInfo;
@end
- Add
CrossOverIPC.h
to your project .
#import "CrossOverIPC.h"
#define _serviceName @"com.cm90.crossOverIPC"
CrossOverIPC *crossOver = [objc_getClass("CrossOverIPC") centerNamed:_serviceName type:SERVICE_TYPE_LISTENER];
[crossOver registerForMessageName:@"UDID_Getter" target:self selector:@selector(handleMSG:userInfo:)];
-(NSDictionary *) handleMSG:(NSString *)msgId userInfo:(NSDictionary *)userInfo {
if ([(NSString *)userInfo[@"action"] isEqual:@"getUDID"])
return @{@"UDID":[UIDevice.currentDevice sf_udidString] ?: @"No udid"};
return @{};
}
#define _serviceName @"com.cm90.crossOverIPC"
CrossOverIPC *crossOver = [objc_getClass("CrossOverIPC") centerNamed:_serviceName type:SERVICE_TYPE_SENDER];
NSDictionary *dict = [crossOver sendMessageAndReceiveReplyName:@"UDID_Getter" userInfo:@{@"action":@"getUDID"}];
CLog(@"[+] UDID : %@",dict[@"UDID"]);
ServiceName
must be the same in [Poster] and [Client] .
This tool is licensed under the MIT License. Feel free to use, modify, and distribute this software in accordance with the MIT License terms. I hope this tool brings value to your projects and endeavors. For more details, please refer to the MIT License documentation.
© 2024 @CrazyMind90. All rights reserved.