ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

[help] C# Regex issue


  • Please log in to reply
[help] C# Regex issue

#1

SeeSharp
SeeSharp
    Offline
    70
    Rep
    188
    Likes

    Developer

Posts: 370
Threads: 90
Joined: Jun 14, 2017
Credits: 0

Six years registered
#1

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!


  • 0

Need some coding done? Check out my service: https://www.nulled.t...-websites-apis/


#2

ksjdgasdeeex
ksjdgasdeeex
    Offline
    80
    Rep
    224
    Likes

    Coders.GG

  • PipPipPipPipPipPip
Posts: 329
Threads: 31
Joined: May 22, 2017
Credits: 0

Six years registered
#2

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!

Add me on Discord: xPolish#8563


  • 0


 Users browsing this thread: