From 7153802c89661efc346ca6c079151b2a183cb60b Mon Sep 17 00:00:00 2001 From: Damian Wessels Date: Tue, 11 Jul 2023 20:16:08 +0200 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ ConsoleApp3.sln | 25 ++++++++++++++ ConsoleApp3/ConsoleApp3.csproj | 14 ++++++++ ConsoleApp3/Program.cs | 60 ++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 .gitignore create mode 100644 ConsoleApp3.sln create mode 100644 ConsoleApp3/ConsoleApp3.csproj create mode 100644 ConsoleApp3/Program.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e029d3d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.vs/ +/ConsoleApp3/bin/ +/ConsoleApp3/obj/ diff --git a/ConsoleApp3.sln b/ConsoleApp3.sln new file mode 100644 index 0000000..8aec5c5 --- /dev/null +++ b/ConsoleApp3.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {81DF414B-B2C2-4A3E-B78C-413128074B0C} + EndGlobalSection +EndGlobal diff --git a/ConsoleApp3/ConsoleApp3.csproj b/ConsoleApp3/ConsoleApp3.csproj new file mode 100644 index 0000000..fad1b3f --- /dev/null +++ b/ConsoleApp3/ConsoleApp3.csproj @@ -0,0 +1,14 @@ + + + + Exe + net7.0 + enable + enable + + + + + + + diff --git a/ConsoleApp3/Program.cs b/ConsoleApp3/Program.cs new file mode 100644 index 0000000..2117fb5 --- /dev/null +++ b/ConsoleApp3/Program.cs @@ -0,0 +1,60 @@ +// See https://aka.ms/new-console-template for more information + +using OpenQA.Selenium.Chrome; +using OpenQA.Selenium; +using System.Diagnostics; +using System.Net; +using System.Text; + +Console.WriteLine("Hello, World!"); + +/* + * + * referalPage: /de/OnePiece +username: Skywalkerex +userPassword: Magnatpower310!! +/de/OnePiece/PostGetAction/User_Login +*/ + + + +ChromeOptions options = new ChromeOptions(); +options.AddArgument("start-maximized"); +ChromeDriver cd = new ChromeDriver(options); +cd.Url = @"https://www.cardmarket.com/de/OnePiece"; + +cd.Navigate(); +cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > button")).Click(); +cd.FindElement(By.Name("username")).Click(); +cd.FindElement(By.Name("username")).SendKeys("Skywalkerex"); +cd.FindElement(By.Name("userPassword")).Click(); + + +cd.FindElement(By.Name("userPassword")).SendKeys("Magnatpower310!!"); +cd.FindElement(By.CssSelector("#header-login > input.btn.AB-login-btn.btn-outline-primary.btn-sm")).Click(); + + +CookieContainer cookieContainer = new CookieContainer(); +foreach (var c in cd.Manage().Cookies.AllCookies) +{ + string name = c.Name; + string value = c.Value; + cookieContainer.Add(new System.Net.Cookie(name, value,c.Path,c.Domain)); +} + +HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid"); +hwr.CookieContainer = cookieContainer; +hwr.Method = "GET"; +hwr.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"; +WebResponse wr = hwr.GetResponse(); +string s = new StreamReader(wr.GetResponseStream()).ReadToEnd(); +Console.WriteLine(s); + +string GetHashKey(string line) +{ + var x = line.IndexOf("__cmtkn"); + var d = line.Substring(x + 16); + var m = d.IndexOf("\""); + var a = d.Substring(0, m); + return a; +} \ No newline at end of file