【Apple Push】 Use javascript to send messages to iMessage groups

67 阅读4分钟

The iMessage promotion technology for large-scale iMessage mainly needs to overcome two technical problems, one is to obtain an iMessage account, and the other is to achieve large-scale iMessage.

Recommended content IMESSGAE related

Recommended content by the author ✈️@IMEAX[iMessage Apple recommended software] *** Click to view the content information requested by the author
Recommended content by author ✈️@IMEAX[1. Family recommended content] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[2. Album recommendation]*** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[3. Calendar recommendation] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[4. Simple virtual machine installation] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[5.iMessage] *** Click to view the content information requested by the author

The current method of getting an iMessage account is to scan a mobile phone number. Scanning mobile numbers can be automatically scanned by code or filtered manually. I haven't found a good way to pass automatic code scanning. I recommend you start with the following two areas:

DM_20220906172912_023.JPEG

  1. Write an AppleScript script to control the iMessage client that comes with MacOS for verification, similar to group iMessage. After sending an iMessage, if you catch an exception that fails to send, it's not an iMessage account.

  2. Research the private API in the Messageframework of the iOS system. Verification through the private API requires manual filtering or verification through the iMessage client included with MacOS. The approach is to write a program that outputs the numbers to be verified to a file, separated by commas. Then, paste the number into the file and then paste it into the address bar of your iMessage client. The iMessage client will automatically check if the number is an iMessage account. Check speed depends on internet speed. Among them, red means not an iMessage account, blue means iMessage account and unselected account. In the first part, the first step is of course to introduce Apple's Push mechanism (APNS)

Continue, there is a difference here, because the development test version of the PP file requires real machine debugging, so we need to bind the real machine. Since I have added some equipment before, I can directly select and add them here. If not, You need to copy the udid of the real machine and add it here. This step is not included in the published PP file;

smartphone-3090801__340.jpg

(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if (application.applicationState == UIApplicationStateActive) { //The program receives push notification during the running process NSLog("%@", [[userInfo objectForKey: @"aps"] objectForKey: @"alert"]); } else { //The program receives push notifications when it is running } } The above code handles how the application receives push notifications in running and inactive states. 3: Download the PHP sample program and set the devicetoken field in it to the token you just saved. Be careful and remove the spaces. Set password to 123456abc, set message to the content you want to configure, save, then enter the php source code path from the command line and run php simplepush.php If your moral character is good enough, your device will immediately make a buzzing sound~ 3: Other things to note 1: You can use the following code to decisively turn on those types of notifications: UIRemoteNotificationType enabledTypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (enabledTypes & UIRemoteNotificationTypeBadge) { //Enable badge number } if (enabledTypes & UIRemoteNotificationTypeSound) { //turn on sound } if (enabledTypes & UIRemoteNotificationTypeAlert) { //turn on alert

Standard mac1 data: 684C81CE

mac1 verification successful!

The application sends the received token to the server, which is the source of the APNS message. 4: The application server sends a message to Apple’s message server through the token and certificate. 5: Apple sends the received message to the corresponding application on the corresponding device. 6: If the application is not in the Active state (not started or backgroud), under the default settings, a message box will pop up at the top of the screen with a sound reminder. Click to change the message box to enter the application. If you do not click, there will be a badge number on the application icon. Present. Two: Use pace The use of APNS is not complicated, but there are many links that are easy to make mistakes, especially the certificate application part, so special attention should be paid. The following is a discussion based on the actual steps I followed in the tutorial: Preparatory matters: A: An Xcode project, we name it MyPushChat, and a corresponding App ID. B: An iOS device that can be used for debugging (APNS can only work on physical devices, and the simulator cannot run) step1: Open "Keychain Access" in "Applications - Tools", as shown in the figure below: In the next dialog box, filter and save to disk. You can fill in the email as you like and name it MyPushChat. Click "Continue", set the file name to "MyPushChat", and click Save. In this way, you will get a file named "MyPushChat.certSigningRequest", which should be kept properly. Get the private key from the csr file you just created. The detailed operation is as shown in the figure below: Name the exported file MyPushChatKey.p12 and enter the password. Please remember this password. It is temporarily set to 123456abc. At this point, we have the file MyPushChat.certSigningRequest, and MyPushChatKey.p12 step2: Find the AppID corresponding to MyPushChat in App IDs, click the "Configure" button on the right, and check the selection box as shown below: Click the configure button on the right side of "Development Push SSL Certificate". The development version should be used for testing. It is only valid for one year and can only use Apple's APNS test server. When the application is released, you need to apply for the Distributions version certificate. The Tokens obtained by the Development and Distribution version certificates are different. The pop-up box is as follows: Upload "MyPushChat.certSigningRequest" and click Generate. After a while, the certificate is generated. Download it and name it "aps_developer_identity.cer". step3: Open the Provision Portal, click New Provision, name the Provision File "MyPushChat", select the corresponding App ID and Device and download it. Get the file MyPushChat.provision. Double-click to import this MyPushChat.Provision file. If everything is normal, Orgnizer will pop up, and the performance interface will be as follows: step4: Save all the files obtained above to your desktop. Open the Console and switch to the desktop. First convert aps_developer_identity.cer to MyPushChat.cert Command: openssl x509 -in aps_developer_identity.cer -inform der-out MyPushChatCert.pem Then convert the private key file to MyPushChatKey.pem Order: openssl pkcs12 -nocerts -out MyPushChatKey.pem -in MyPushChatKey.p12 Enter Import Password: The password entered here is the password set later for the private key: 123456abc

MAC verified OK

Enter PEM pass phrase:

You must enter a new password here, we set it to 123456abc

Verifying - Enter PEM pass phrase:

     }



     Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();

     for (InetAddress inetAddress : Collections.list(inetAddresses)) {

         out.printf("InetAddress: %s\n", inetAddress);

         System.out

                 .println("InetAddress ip=" + inetAddress.getHostAddress());

     }

     out.printf("\n");

 }

Recommended content IMESSGAE related

Recommended content by the author ✈️@IMEAX[iMessage Apple recommended software] *** Click to view the content information requested by the author
Recommended content by author ✈️@IMEAX[1. Family recommended content] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[2. Album recommendation]*** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[3. Calendar recommendation] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[4. Simple virtual machine installation] *** Click to view the content information requested by the author
Recommended content by the author ✈️@IMEAX[5.iMessage] *** Click to view the content information requested by the author
 public static boolean validateMacAddress(String macAddress)

         throws SocketException {

     boolean returnFlag = false;

     Enumeration<NetworkInterface> nets = NetworkInterface

             .getNetworkInterfaces();

     for (NetworkInterface netint : Collections.list(nets)) {

         byte[] mac = netint.getHardwareAddress();

         StringBuilder sb = new StringBuilder();

         if (mac != null) {

             for (int i = 0; i < mac.length; i++) {

                 sb.append(String.format("%02X%s", mac[i],

                         (i < mac.length - 1) ? "-" : ""));

             }