自动化操作之iMessage群发

 Apple公司全线在mac os与ios两个操作系统上内置了FaceTime与iMessage两个应用。完美替代运营商的短信与电话。并且FaceTime与iMessage的帐号不仅仅与Apple ID 绑定,同时也与使用这Apple ID的手机号码绑定,这样的漏洞自然给无孔不入的群发垃圾信息商们提供了后门。
研究怎么实现iMessage群发先是从XMPP协议开始的,因为Apple MAC os上的ichat是XMPP客户端,可以连接iMessage服务器,同时也可连接gtalk与weibo私信。但后面发现iMessage的服务器验证是加密,没办法实现非ichat XMPP客户端连接iMeesage服务器,那就自然没办法实现程序控制往iMeesage服务器批量发送信息。
只能通过MAC OS或者iOS自带的程序往iMeesage服务器发送信息,那要实现群发,自然只能想办法去调用自带的这ichat客户端,在MAC OS系统上Apple公司提供一种叫Apple script的脚本来自动实现任务。可能通过tell application "Messages"就可以激活iMessage客户端自动发送信息。这样实现的群发的思路就很清楚了

 

iMessage协议初接触:

public class MyProxy : RealProxy
{
String myURIString;
 MarshalByRefObject myMarshalByRefObject;   
[PermissionSet(SecurityAction.LinkDemand)]
   public MyProxy(Type myType) :   base (myType)
   {
      // RealProxy uses the Type to generate a transparent proxy.
      myMarshalByRefObject = (MarshalByRefObject)Activator.CreateInstance((myType));
      // Get 'ObjRef', for transmission serialization between application domains.
      ObjRef myObjRef = RemotingServices.Marshal(myMarshalByRefObject);
      // Get the 'URI' property of 'ObjRef' and store it.
      myURIString = myObjRef.URI;
      Console.WriteLine(  "URI :{0}" , myObjRef.URI);
   }

   [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)]
   public override IMessage Invoke(IMessage myIMessage)
   {
      Console.WriteLine(  "MyProxy.Invoke Start" );
      Console.WriteLine(  "" );

      if (myIMessage   is IMethodCallMessage)
         Console.WriteLine(  "IMethodCallMessage" );

      if (myIMessage   is IMethodReturnMessage)
         Console.WriteLine(  "IMethodReturnMessage" );

      Type msgType = myIMessage.GetType();
      Console.WriteLine(  "Message Type: {0}" , msgType.ToString());
      Console.WriteLine(  "Message Properties" );
      IDictionary myIDictionary = myIMessage.Properties;
      // Set the '__Uri' property of 'IMessage' to 'URI' property of 'ObjRef'.
      myIDictionary[  "__Uri" ] = myURIString;
      IDictionaryEnumerator myIDictionaryEnumerator = 
         (IDictionaryEnumerator) myIDictionary.GetEnumerator();

      while (myIDictionaryEnumerator.MoveNext())
      {
         Object myKey = myIDictionaryEnumerator.Key;
         String myKeyName = myKey.ToString();
         Object myValue = myIDictionaryEnumerator.Value;

         Console.WriteLine(  "\t{0} : {1}" , myKeyName, 
            myIDictionaryEnumerator.Value);
         if (myKeyName ==   "__Args" )
         {
            Object[] myObjectArray = (Object[])myValue;
            for (  int aIndex = 0; aIndex < myObjectArray.Length; aIndex++)
               Console.WriteLine(  "\t\targ: {0} myValue: {1}" , aIndex, 
                  myObjectArray[aIndex]);
         }

         if ((myKeyName ==   "__MethodSignature" ) && (  null != myValue))
         {
            Object[] myObjectArray = (Object[])myValue;
            for (  int aIndex = 0; aIndex < myObjectArray.Length; aIndex++)
               Console.WriteLine(  "\t\targ: {0} myValue: {1}" , aIndex, 
                  myObjectArray[aIndex]);
         }
      }
    
      IMessage myReturnMessage;
      myIDictionary[  "__Uri" ] = myURIString;
      Console.WriteLine(  "__Uri {0}" , myIDictionary[  "__Uri" ]);

      Console.WriteLine(  "ChannelServices.SyncDispatchMessage" );
      myReturnMessage = ChannelServices.SyncDispatchMessage(myIMessage);

      // Push return value and OUT parameters back onto stack.

      IMethodReturnMessage myMethodReturnMessage = (IMethodReturnMessage)
         myReturnMessage;
      Console.WriteLine(  "IMethodReturnMessage.ReturnValue: {0}" , 
         myMethodReturnMessage.ReturnValue);

      Console.WriteLine(  "MyProxy.Invoke - Finish" );

      return myReturnMessage;
   }
}

 

posted @ 2026-02-05 11:52  知秋's  阅读(11)  评论(0)    收藏  举报