Hi guys i'm making a cracker and im getting the name and the value of a csrf input field. The problem is that im not getting a match in c# while i'm getting a match at regex101. I hope you guys see the problem i can find a solution for me. I'm pretty new to regex so maybe it's a beginner mistake.
reply = tmpAnswer.ReadToEnd(); string csrfName = ""; string csrfValue = ""; string pattern = @"<input type=\\""hidden\\"" name=\\""action\\"" value=\\""customerlogin\\"" \/>\\n[^>]*<input type=\\""hidden\\"" name=\\""(.*?)\\"" value=\\""[^>]*\\"""; RegexOptions options = RegexOptions.Multiline; foreach (Match m in Regex.Matches(reply, pattern, options)) { Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index); }
this is what the reply looks like:
\n <dt>Inloggen</dt>\n\n \n <div class=\"userpanel-login\" id=\"userpanel-login\">\n <form id=\"icustomerloginform\" method=\"post\" onsubmit=\"xmlFormSubmit('icustomerloginform','userpanel-wrapper','/xHttp/CustomerPanel.php'); return false;\">\n <input type=\"hidden\" name=\"open\" value=\"login\" />\n <input type=\"hidden\" name=\"action\" value=\"customerlogin\" />\n <input type=\"hidden\" name=\"af786d75ba\" value=\"c2560ae055a8555260e798ff8c762ba2084385d8150e17f40992a92b79909f4f\" />\n <input type=\"hidden\" name=\"redirect\" value=\"myaccount\">\n\n <div class=\"textarea-label\">\n E-mailadres <div class=\"textfield_form\"><input type=\"text\" name=\"username\" value=\"\" class=\"textfield_form\" id=\"iusername\" maxlength=\"100\"></div> </div>\n <div class=\"textarea-label\">\n Wachtwoord <div class=\"textfield_form\"><input type=\"password\" name=\"password\" value=\"\" class=\"textfield_form\" id=\"ipassword\"><span class=\"icon togglepassword\" id=\"togglepassword\"><i></i><span></div> </div>\n <input type=\"submit\" value=\"Inloggen\" class=\"button_form button-cta-small\"> <div class=\"separator\">\r\n <span>of</span>\r\n </div>\r\n\r\n <button id=\"facebooklogin\" onclick=\"return false\" class=\"button-cta-small button-facebook\">Inloggen via Facebook</button><div id=\"status\"></div>\r\n </form>\n\n <div class=\"loginoptions\">\n <a class=\"text-link modal-back\" href=\"#\">Terug</a>\n <span>|</span>\n <a class=\"text-link\" href=\"#\" onClick=\"xmlRequest('/xHttp/CustomerRetrievePassword.php','','userpanel-wrapper');return false;\" rel=\"nofollow\">Wachtwoord vergeten?</a>\n <span>|</span>\n <a class=\"text-link\" id=\"cslink\" href=\"/klantenservice\">Hulp nodig?</a>\n </div>\n\n </div>\n\n\n
Thanks in advance i hope someone can help me with this!