Esempio n. 1
0
        public static void OnWebSocketMessage(object sender, WebSocketMessageEventArgs e)
        {
            Session session = (Session)sender;

            if ((session.fullUrl.IndexOf("-ws.va.huya.com") != -1 ? true : session.fullUrl.IndexOf("wsapi.huya.com") != -1))
            {
                HookMgr.LockByteArray(e.oWSM.PayloadData, string.Format("Mask={0} Fiddler原数据    ", e.oWSM.MaskingKey != null));
                byte[] arr = e.oWSM.PayloadAsBytes();
                HookMgr.LockByteArray(arr, string.Concat(string.Format("{0}  控制:{1} {2}", session.fullUrl, e.oWSM.FrameType, e.oWSM.IsFinalFrame), string.Format(" {0} Mask={1} Fiddler解Mask的    ", (e.oWSM.IsOutbound ? "发送" : "接收"), e.oWSM.MaskingKey != null)));
                WebSocket webs = session.__oTunnel as WebSocket;
                if (arr.Length != 0)
                {
                    try
                    {
                        XTrace.WriteLine(string.Format("消息列表 {0} 个", webs.listMessages.Count));
                        if (!e.oWSM.IsOutbound)
                        {
                            HookHyWebSocketNet.RecvData(arr);
                        }
                        else
                        {
                            HookHyWebSocketNet.SendData(arr);
                        }
                    }
                    catch (Exception exception)
                    {
                        XTrace.WriteLine(string.Concat("序列化包出错 ", exception.ToString()));
                    }
                }
            }
        }
Esempio n. 2
0
 public static void RspWanCheng(Session session)
 {
     if (session.bHasResponse)
     {
         if (HookMgr.NeedWeiBoYanZhengMa)
         {
             if (session.fullUrl.IndexOf("login.sina.com.cn/cgi/pin.php?r=") != -1)
             {
                 session.utilDecodeResponse();
                 lock (HookMgr.WeiBoYanZhengMaLock)
                 {
                     HookMgr.WeiBoYanZhengMa = session.responseBodyBytes;
                 }
             }
         }
         HookMgr.PhoneIsRegFun(session);
         HookMgr.ylog(session);
     }
 }
Esempio n. 3
0
 public static void ReplaceHyDeviceJs(Session ReqSession)
 {
     if (ReqSession.fullUrl.IndexOf("google.com") == -1)
     {
         if ((!HookMgr.UpCookie ? false : ReqSession.fullUrl.IndexOf(":443") == -1))
         {
             ReqSession.bBufferResponse = true;
             string old        = ReqSession.oRequest.headers["Cookie"];
             string UserCookie = HttpHelper.GetMergeCookie(HookMgr.curCookie, old);
             ReqSession.oRequest.headers["Cookie"] = UserCookie;
         }
         HookMgr.NeedImmediatelyReturn(ReqSession);
     }
     else
     {
         ReqSession.bBufferResponse = true;
         ReqSession.utilCreateResponseAndBypassServer();
         ReqSession.oResponse.headers.SetStatus(502, "Failed");
         ReqSession.oResponse.headers.HTTPResponseCode = 502;
         ReqSession.oResponse.headers.HTTPVersion      = "HTTP/1.1";
     }
 }
Esempio n. 4
0
 private static void AttachEventListeners()
 {
     FiddlerApplication.OnNotification       += new EventHandler <NotificationEventArgs>((object o, NotificationEventArgs nea) => {
     });
     FiddlerApplication.Log.OnLogString      += new EventHandler <LogEventArgs>((object o, LogEventArgs lea) => {
     });
     FiddlerApplication.BeforeRequest        += new SessionStateHandler((Session session) => HookMgr.ReplaceHyDeviceJs(session));
     FiddlerApplication.AfterSessionComplete += new SessionStateHandler((Session session) => HookMgr.RspWanCheng(session));
     Console.CancelKeyPress += new ConsoleCancelEventHandler((object o, ConsoleCancelEventArgs ccea) => FiddlerMgr.Quit());
 }