Exemple #1
0
        public XmlNodeEx LoadXml(string manifestUrl)
        {
            string xmlText = "";

            if (string.IsNullOrEmpty(postData))
            {
                xmlText = HTTP.GET(manifestUrl);
            }
            else
            {
                xmlText = HTTP.POST(manifestUrl, postData);
            }

            if (Program.RegExMatch(@"<r>\s*?<to>(.*?)</to>", xmlText, out string sDomain))
            {
                if (Program.RegExMatch(@"^.*?://.*?/.*?/(.*)", manifestUrl, out manifestUrl))
                {
                    manifestUrl = sDomain + manifestUrl;
                    xmlText     = HTTP.GET(manifestUrl);
                }
            }

            xmlText = XmlValidate(xmlText);

            XmlDocumentEx xmldoc = new XmlDocumentEx();

            try {
                xmldoc.LoadXml(xmlText);
            } catch (Exception e) {
                if (Regex.IsMatch(xmlText, @"<html.*?<body", RegexOptions.Singleline))
                {
                    throw new XmlException("Error loading manifest. Url redirected to html page. Check the manifest url.", e);
                }
                else
                {
                    throw new XmlException("Error loading manifest. It's no valid xml file.", e);
                }
            }
            return((XmlNodeEx)xmldoc.DocumentElement);
        }
Exemple #2
0
        private static void GetLink_Moonwalk(string sLink)
        {
            string sHtml, sData, sPost; Match m;

            HTTP.Referer = sLink;
            sLink        = sLink.Replace("moonwalk.co", "moonwalk.cc");
            sLink        = sLink.Replace("moonwalk.pw", "moonwalk.cc");
            sHtml        = HTTP.GET(sLink);
            if (Regex.IsMatch(sHtml, "<iframe[^>]+src=\"(http.*?)\"", RegexOptions.Singleline))
            {
                sLink = sLink.Replace("moonwalk.co", "moonwalk.cc");
                sLink = sLink.Replace("moonwalk.pw", "moonwalk.cc");
                sHtml = HTTP.GET(sLink);
            }
            m = Regex.Match(sHtml, "\"csrf-token\"\\s+content=\"(.*?)\"");
            if (m.Success)
            {
                HTTP.Headers.Set("X-CSRF-Token", m.Groups[1].Value);
            }
            foreach (Match match in Regex.Matches(sHtml, "Set-Cookie:\\s*([^;]+)"))
            {
                HTTP.Cookies += " " + match.Groups[1].Value + ";";
            }
            string server = Regex.Match(sLink, "^(.*?//.*?)/").Groups[1].Value;

            HTTP.Headers.Set("Origin", server);
            HTTP.Headers.Set("X-Requested-With", "XMLHttpRequest");
            HTTP.Headers.Set("Pragma", "no-cache");
            m = Regex.Match(sHtml, "ajaxSetup\\([^)]+headers:(.*?)}", RegexOptions.Singleline);
            if (m.Success)
            {
                foreach (Match match in Regex.Matches(m.Groups[1].Value, "[\"']([\\w-_]+)[\"']\\s*?:\\s*?[\"'](\\w+)[\"']"))
                {
                    HTTP.Headers.Set(match.Groups[1].Value, match.Groups[2].Value);
                }
            }
            m = Regex.Match(sHtml, "window\\[[^]]+]\\s*=\\s*\\{(.*?)\\}", RegexOptions.Singleline);
            if (!m.Success)
            {
                Quit("Not found post parameters in moonwalk iframe");
            }
            sPost = m.Groups[1].Value.Replace("\n", "").Replace(" ", "").Replace("'", "");
            sPost = sPost.Replace(':', '=').Replace(',', '&').Replace(':', '=').Replace(':', '=').Replace("condition_detected?1=", "");
            foreach (Match match in Regex.Matches(sPost, ".=(\\w+)"))
            {
                m = Regex.Match(sHtml, "var\\s" + match.Groups[1].Value + "\\s*=\\s*['\"](.*?)['\"]");
                if (m.Success)
                {
                    sPost = sPost.Replace("=" + match.Groups[1].Value, "=" + m.Groups[1].Value);
                }
            }
            foreach (Match match in Regex.Matches(sHtml, "post_method\\.(\\w+)\\s*=\\s*(\\w+)"))
            {
                m = Regex.Match(sHtml, "var\\s" + match.Groups[1].Value + "\\s*=\\s*['\"](.*?)['\"]");
                if (m.Success)
                {
                    sPost += "&" + match.Groups[1].Value + "=" + m.Groups[1].Value;
                }
            }
            foreach (Match match in Regex.Matches(sHtml, "\\['(\\w+)'\\]\\s*=\\s*'(.*?)'"))
            {
                sPost += "&" + match.Groups[1].Value + "=" + match.Groups[2].Value;
            }
            foreach (Match match in Regex.Matches(sHtml, "window\\[[^\\]]+\\]\\[(.*?)\\]\\s*=\\s*(.*?);"))
            {
                string sVar = match.Groups[1].Value.Replace("+", "").Replace(" ", "").Replace("'", "");
                string sVal = match.Groups[2].Value.Replace("+", "").Replace(" ", "").Replace("'", "");
                sPost += "&" + sVar + "=" + sVal;
            }
            m = Regex.Match(sHtml, "'(/manifests/.*?)'");
            if (!m.Success)
            {
                Quit("Not found url for POST query in moonwalk iframe");
            }
            sData = HTTP.POST(server + m.Groups[1].Value, sPost);
            m     = Regex.Match(sData, "\"manifest_f4m\"\\s*?:\\s*?\"(.*?)\"");
            if (m.Success)
            {
                manifestUrl = Regex.Unescape(m.Groups[1].Value);
            }
        }