コード例 #1
0
        private async Task UpdateRoute()
        {
            List <string> route    = new List <string>();
            string        reqUri   = "index.php?action=gate&a2=connect";
            string        response = await SendRequest.GET(reqUri);

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(response);

            HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//td[@colspan=2]/span[@class='green']");

            if (nodes != null)
            {
                foreach (HtmlNode node in nodes)
                {
                    string ip = node.InnerText;
                    route.Add(ip);
                }
            }

            StringBuilder output = new StringBuilder();

            foreach (string i in route)
            {
                output.Append($" > {i}");
            }

            Route = output.ToString();
        }
コード例 #2
0
        private async Task LoadDataTask()
        {
            LogList.Clear();

            int o = 0;
            int i = -1;

            while (true)
            {
                if (i >= 50)
                {
                    break;
                }

                string reqUri         = "index.php?action=gate&a2=logs&_o=" + o;
                string responseString = await SendRequest.GET(reqUri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseString);

                HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//td[@class='dbg' and @valign='top']");

                if (nodes == null)
                {
                    break;
                }

                foreach (HtmlNode n in nodes)
                {
                    LogModel l = new LogModel();
                    l.Time = n.InnerText;
                    LogList.Add(l);
                }

                HtmlNodeCollection nodes2 = doc.DocumentNode.SelectNodes(@"//textarea[@name='log_str']");


                foreach (HtmlNode n2 in nodes2)
                {
                    i++;
                    string s = n2.InnerText;
                    LogList[i].Logs = s;
                    if (s.Contains("[localhost]") || s.Contains("Origin proxy") || s.Contains("Kernel"))
                    {
                        LogList[i].Alert = 0;
                    }
                    else if (s.Contains("Download"))
                    {
                        LogList[i].Alert = 1;
                    }
                    else
                    {
                        LogList[i].Alert = 2;
                    }
                }

                o += 10;
            } //end while
        }
コード例 #3
0
        private async Task ActionTask(ACTION act)
        {
            if (SelectedItem != null)
            {
                switch (act)
                {
                case ACTION.RUN:
                    await SendRequest.GET(SelectedItem.Run);

                    break;

                case ACTION.DELETE:
                    await SendRequest.GET(SelectedItem.Delete);

                    break;

                case ACTION.HIDE:
                    await SendRequest.GET(SelectedItem.Hide);

                    break;

                case ACTION.UNHIDE:
                    await SendRequest.GET(SelectedItem.Unhide);

                    break;

                case ACTION.ENCRYPT:
                    await SendRequest.GET(SelectedItem.Encrypt);

                    break;

                case ACTION.DECRYPT:
                    await SendRequest.GET(SelectedItem.Decrypt);

                    break;

                case ACTION.PUBLIC:
                    await SendRequest.GET(SelectedItem.Public);

                    break;

                case ACTION.PRIVATE:
                    await SendRequest.GET(SelectedItem.Private);

                    break;

                case ACTION.UPLOAD:
                    await SendRequest.GET(SelectedItem.Upload);

                    break;

                case ACTION.DOWNLOAD:
                    await SendRequest.GET(SelectedItem.Download);

                    break;
                }
                ViewModelManager.RunningProcessViewModelInstance.LoadData();
            }
        }
コード例 #4
0
        private async Task LoadDataTask()
        {
            var loadRoute = UpdateRoute();

            IPList.Clear();

            int o = 0;

            while (true)
            {
                string reqUri         = "index.php?action=ip_db&a2=pub&_o=" + o;
                string responseString = await SendRequest.GET(reqUri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseString);

                HtmlNode node = doc.DocumentNode.SelectSingleNode(@"//form[@name='frm_mis']");

                HtmlNodeCollection childs = node.SelectNodes(@"//form[@name='frm_mis']/tr");

                int count = 0;

                for (int i = 0; i < childs.Count; i++)
                {
                    if (i == 0 || i == childs.Count - 1 || childs[i] == null)
                    {
                        continue;
                    }

                    string ip      = childs[i].SelectSingleNode(@"./td[@class='green']/a").InnerText;
                    string name    = StringHelper.RemoveSpecial(childs[i].SelectSingleNode(@"./td[4]").InnerText);
                    string admin   = childs[i].SelectSingleNode(@"./td[5]/i").InnerText;
                    string owned   = childs[i].SelectSingleNode(@"./td[6]").InnerText;
                    string connect = childs[i].SelectSingleNode(@".//tr[@class='m2']/td[1]/a").GetAttributeValue("href", "");
                    string bounce  = childs[i].SelectSingleNode(@".//tr[@class='m2']/td[2]/a").GetAttributeValue("href", "");

                    IPDBModel newData = new IPDBModel()
                    {
                        IP      = ip,
                        Name    = name,
                        Admin   = admin,
                        Owned   = owned,
                        Connect = connect,
                        Bounce  = bounce
                    };
                    IPList.Add(newData);
                    count++;
                }

                if (count == 0)
                {
                    break;
                }

                o += 20;
            }
            await loadRoute;
        }
コード例 #5
0
        private async Task <bool> LogoutTask()
        {
            string reqUri         = "index.php?action=logout";
            string responseString = await SendRequest.GET(reqUri);

            if (string.IsNullOrEmpty(responseString))
            {
                SessionId = "Logout error";
                return(false);
            }

            SessionId = "Offline";
            return(true);
        }
コード例 #6
0
        private async Task LoadDataTask()
        {
            RunningProcessList.Clear();

            int o = 0;

            while (true)
            {
                string reqUri         = "index.php?action=gate&a2=run&_o=" + o;
                string responseString = await SendRequest.GET(reqUri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseString);

                HtmlNode node = doc.DocumentNode.SelectSingleNode(@"//form[@name='frm_files']/table");

                HtmlNodeCollection childs           = node.ChildNodes;
                string[]           stringSeparators = new string[] { "'" };

                int count = 0;

                foreach (HtmlNode n in childs)
                {
                    if (n.Name.Equals("script") && n.InnerText.Contains("document.write"))
                    {
                        string   text   = n.InnerText;
                        string[] splits = text.Split(stringSeparators, StringSplitOptions.None);

                        string encoded = splits[1];
                        string decoded = WebUtility.UrlDecode(encoded);

                        AddProcess(decoded);

                        count++;
                    }
                }

                if (count == 0)
                {
                    break;
                }

                o += 50;
            }
        }
コード例 #7
0
        private async Task ActionTask(ACTION act)
        {
            if (SelectedItem != null)
            {
                switch (act)
                {
                case ACTION.KILL:
                    await SendRequest.GET(SelectedItem.Kill);

                    break;

                case ACTION.COMPLETE:
                    await SendRequest.GET(SelectedItem.Complete);

                    break;
                }
                await LoadDataTask();
            }
        }
コード例 #8
0
        private async Task ActionTask(ACTION act)
        {
            if (SelectedItem != null)
            {
                switch (act)
                {
                case ACTION.CONNECT:
                    await SendRequest.GET(SelectedItem.Connect);

                    break;

                case ACTION.BOUNCE:
                    await SendRequest.GET(SelectedItem.Bounce);

                    break;
                }
                await LoadDataTask();
            }
        }
コード例 #9
0
        private async Task LoadDataTask()
        {
            string reqUri         = "index.php?action=gate&a2=run";
            string responseString = await SendRequest.GET(reqUri);

            var doc = new HtmlDocument();

            doc.LoadHtml(responseString);

            HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//td[@colspan='6']/span[@class='g']");

            CurCPU       = nodes[0].InnerText;
            MaxCPU       = nodes[1].InnerText;
            CurRAM       = nodes[2].InnerText;
            MaxRAM       = nodes[3].InnerText;
            CurBandwidth = nodes[4].InnerText;
            MaxBandwidth = nodes[5].InnerText;

            nodes = doc.DocumentNode.SelectNodes(@"//td[@colspan='6']/span[@class='p']");

            PerCPU       = nodes[0].InnerText;
            PerRAM       = nodes[1].InnerText;
            PerBandwidth = nodes[2].InnerText;

            string reqUri2         = "index.php?action=gate&a2=files";
            string responseString2 = await SendRequest.GET(reqUri2);

            doc = new HtmlDocument();
            doc.LoadHtml(responseString2);

            nodes = doc.DocumentNode.SelectNodes(@"//td[@colspan='6']/span[@class='g']");

            CurHDD = nodes[0].InnerText;
            MaxHDD = nodes[1].InnerText;

            nodes = doc.DocumentNode.SelectNodes(@"//td[@colspan='6']/span[@class='p']");

            PerHDD = nodes[0].InnerText;
        }
コード例 #10
0
        private async Task LoadDataTask()
        {
            FileProgramList.Clear();

            string reqUri         = "index.php?action=gate&a2=files";
            string responseString = await SendRequest.GET(reqUri);

            if (string.IsNullOrEmpty(responseString))
            {
                Console.WriteLine("Load program: null");
                return;
            }

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(responseString);

            HtmlNode node = doc.DocumentNode.SelectSingleNode(@"//form[@name='frm_files']/table");

            HtmlNodeCollection childs = node.ChildNodes;

            string[] stringSeparators = new string[] { "'" };


            foreach (HtmlNode n in childs)
            {
                if (n.Name.Equals("script") && n.InnerText.Contains("document.write"))
                {
                    string   text   = n.InnerText;
                    string[] splits = text.Split(stringSeparators, StringSplitOptions.None);

                    string encoded = splits[1];
                    string decoded = WebUtility.UrlDecode(encoded);

                    AddProgram(decoded);
                }
            }
        }
コード例 #11
0
        private async Task LoadMarkedTask(string uri)
        {
            MarkedList.Clear();
            int o = 0;

            while (true)
            {
                string reqUri         = uri + o;
                string responseString = await SendRequest.GET(reqUri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseString);

                HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//form[@name='frm_mis']/tr");

                int count = 0;

                Regex regex = new Regex(@"# \d+");
                for (int i = 0; i < nodes.Count; i++)
                {
                    if (i == 0 || i == nodes.Count - 1)
                    {
                        continue;
                    }

                    string complete = nodes[i].SelectSingleNode(@"./td[1]/table/tr[@class='m2']//a").GetAttributeValue("href", "");
                    string mark     = ""; // nodes[i].SelectSingleNode(@"./td[1]/table/tr[2]//a").GetAttributeValue("href", "");
                    string targetIP = nodes[i].SelectSingleNode(@"./td[2]/table/tr[1]//a/span[@class='green']").InnerText;
                    string type     = nodes[i].SelectSingleNode(@"./td[3]/a/span").InnerText;
                    string detail   = StringHelper.RemoveSpecial(nodes[i].SelectSingleNode(@"./td[4]//td[@align='justify']").InnerText);
                    string reward   = nodes[i].SelectSingleNode(@"./td[5]").InnerText;
                    string fileID   = "";
                    var    match    = regex.Match(detail);
                    if (match.Success)
                    {
                        fileID = match.Value.Replace("#", "").Trim();
                    }

                    MissionModel newData = new MissionModel()
                    {
                        Complete = complete,
                        Mark     = mark,
                        TargetIP = targetIP,
                        Type     = type,
                        Details  = detail,
                        Reward   = reward,
                        FileID   = fileID
                    };
                    MarkedList.Add(newData);

                    count++;
                }

                if (count == 0)
                {
                    break;
                }

                o += 50;
            }
        }