Esempio n. 1
0
        internal static string ChekingPersonName(HttpRequest request, string personid)
        {
            var person   = new SearchedPerson();
            var response = request.Get("vk.com/" + personid).ToString();

            return(response.Substring("<h2 class=\"page_name\">", response.Contains("page_verified") ? "<div class>" : "</h2>"));

            //Console.WriteLine("Not logged {0}",response.Substring("id=\"page_current_info\">","</div>"));
        }
Esempio n. 2
0
        private static void Main()
        {
            Console.Write(@"Enter your mail: ");
            //var login = Console.ReadLine();
            fasdf
            var request = new HttpRequest()
            {
                UserAgent = Http.ChromeUserAgent(),
                Cookies   = new CookieDictionary()
            };
            var response =
                request.Get(
                    "vk.com").ToString();
            var rp = new RequestParams
            {
                ["act"]         = "login",
                ["role"]        = "al_frame",
                ["ip_h"]        = response.Substring("ip_h\" value=\"", "\""),
                ["lg_h"]        = response.Substring("lg_h\" value=\"", "\""),
                ["_origin"]     = "https://vk.com",
                ["captcha_sid"] = "",
                ["captcha_key"] = "",
                ["email"]       = login,
                ["pass"]        = password,
                ["expire"]      = "0"
            };

            Console.Title = "Ksuwa Cheker";
            Console.SetOut(new PrefixedWriter());
            bool isLoggined;

            do
            {
                isLoggined = MainWork.TryToLogin(request, rp, login, password);
            }while (isLoggined == false);
            Console.WriteLine("end");
            var searchedPerson = new SearchedPerson();
            var wrongValue     = true;

            {
                while (wrongValue)
                {
                    try
                    {
                        Console.Write(@"Enter person id: vk.com/");
                        searchedPerson.PersonId = Console.ReadLine();
                        if (string.IsNullOrEmpty(searchedPerson.PersonId))
                        {
                            throw new ArgumentNullException(nameof(searchedPerson.PersonId));
                        }
                        searchedPerson.PersonName = MainWork.ChekingPersonName(request, searchedPerson.PersonId);
                        Console.WriteLine(@"Person found: {0}", searchedPerson.PersonName);
                        searchedPerson.Online = MainWork.ChekingOnline(request, searchedPerson.PersonId);
                        if (searchedPerson.Online)
                        {
                            Console.WriteLine("{0} is online!", searchedPerson.PersonName);
                            Console.Write("Do you wanna get notified when person come offline? Y/N: ");
                            if (Console.ReadLine() == "Y")
                            {
                                NotifyThenOffline(searchedPerson.PersonId, request, true, searchedPerson.PersonName);
                            }
                            else
                            {
                                Environment.Exit(0);
                            }
                        }
                        else
                        {
                            Console.WriteLine("{0} is offline!", searchedPerson.PersonName);
                            Console.WriteLine("{0}", MainWork.GettingLastOnline(request, searchedPerson.PersonId));
                            Console.Write("Do you wanna get notified when person come online? Y/N: ");
                            if (Console.ReadLine() == "Y")
                            {
                                NotifyThenOffline(searchedPerson.PersonId, request, false, searchedPerson.PersonName);
                            }
                            else
                            {
                                Environment.Exit(0);
                            }
                        }
                        wrongValue = false;
                    }
                    catch (Exception exception)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(exception.Message);
                        Console.ResetColor();
                    }
                }
            }


            Console.ReadKey();
        }