diff --git a/Proxy/Extends/Tableau.cs b/Proxy/Extends/Tableau.cs deleted file mode 100644 index c4c3590..0000000 --- a/Proxy/Extends/Tableau.cs +++ /dev/null @@ -1,223 +0,0 @@ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Linq; -using UMC.Web; -using UMC.Net; -namespace UMC.Proxy.Extends -{ - - - public class Tableau : Proxy.SiteProxy - { - - string encryptedPassword(Hashtable hashtable, String passwrod) - { - var key = hashtable["key"] as Hashtable; - return UMC.Data.Utility.Hex(UMC.Data.Utility.RSA(key["n"] as string, key["e"] as string, passwrod)); - } - public override bool Proxy(HttpProxy proxy) - { - if (proxy.RawUrl.StartsWith("/t/")) - { - Chart(proxy); - - return true; - } - else if (proxy.RawUrl.StartsWith("/vizportal/api/web/v1/getSessionInfo")) - { - getSessionInfo(proxy); - return true; - } - return false; - } - void Login(HttpProxy proxy, Action callback) - { - - var webReq = proxy.Reqesut(new Uri(proxy.Domain, "/vizportal/api/web/v1/generatePublicKey").WebRequest(proxy.Cookies)); - webReq.Post(new WebMeta().Put("method", "generatePublicKey").Put("params", new WebMeta()), responseMessage => - { - responseMessage.ReadAsString(kko => - { - var result = UMC.Data.JSON.Deserialize(kko) as Hashtable; - var publicKey = result["result"] as Hashtable; - var Value = new WebMeta(); - - proxy.ShareUser(); - Value.Put("username", proxy.SiteCookie.Account, "encryptedPassword", encryptedPassword(publicKey, proxy.Password), "keyId", publicKey["keyId"] as string); - - var login = new WebMeta().Put("method", "login").Put("params", Value); - - proxy.Reqesut(proxy.Context.Transfer(new Uri(proxy.Domain, "/vizportal/api/web/v1/login"), proxy.Cookies)) - .Post(login, h => - { - h.ReadAsData((b, i, c) => - { - if (b.Length == 0 && c == 0) - { - if (i == -1) - { - proxy.Context.Error(h.Error); - } - else - { - callback(); - } - } - }); - }); - - - proxy.IsChangeUser = true; - - }, proxy.Context.Error); - }); - - - } - void Chart(HttpProxy proxy) - { - - if (proxy.RawUrl.Contains("Cache=NO")) - { - Login(proxy, () => - { - proxy.Reqesut(proxy.Context.Transfer(new Uri(proxy.Domain, proxy.RawUrl), proxy.Cookies)).Get(re => Chart(re, proxy)); ; - }); - - } - else if (proxy.SiteCookie != null && (proxy.SiteCookie.LoginTime ?? 0) + 600 < UMC.Data.Utility.TimeSpan()) - { - Login(proxy, () => - { - proxy.Reqesut(proxy.Context.Transfer(new Uri(proxy.Domain, proxy.RawUrl), proxy.Cookies)).Get(re => Chart(re, proxy)); ; - }); - } - else - { - proxy.Reqesut(proxy.Context.Transfer(new Uri(proxy.Domain, proxy.RawUrl), proxy.Cookies)).Get(re => - { - if (re.StatusCode == HttpStatusCode.Found) - { - Login(proxy, () => - { - proxy.Reqesut(proxy.Context.Transfer(new Uri(proxy.Domain, proxy.RawUrl), proxy.Cookies)).Get(res => Chart(res, proxy)); ; - }); - } - else - { - Chart(re, proxy); - } - }); - - } - } - void Chart(NetHttpResponse re, HttpProxy proxy) - { - re.ReadAsString(Result => - { - var webResource = proxy.WebResource; - - var cdnKey = proxy.MD5(proxy.Site.Caption); - - var regex = new System.Text.RegularExpressions.Regex("(?\\shref|\\ssrc)=\"(?[^\"]+)\""); - - var bIndex = Result.IndexOf("