quickregister 1 Posted December 10, 2017 Report Share Posted December 10, 2017 I am trying to do a http post to log into a site.Below is what I got from live http headers CSRFName=CSRF1103754532_791906178&CSRFToken=8687482b73766e6d88494351e4ee362f118d103d36d93e2855a79056449754f9f8ea5ebe9e96b4673bad22076774ec85d8c7d7f5b4c4cdd3bd577f2921ee7eab&page=login&action=login_post&email=info%40mydomain.com&password=password: undefinedI need to be able to extract the CSRFNameand the CSRFToken using regex and save it to a list. The part I am stuck on is extracting the CSRFName and CSRFTokenin order to put those variables in the http post. I tried using this (?<=CSRFName\=).(?=\&CSRFToken) To get the CSRFName.Not working. If somebody could point me in the direction I would really appreciate it. The site I am trying to log into is http://www.freeglobalclassifiedads.com/user/login Thank you. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted December 10, 2017 Report Share Posted December 10, 2017 You are very close, you need to put a * after the . because you want more than one (of anything), try this: set(#input,"CSRFName=CSRF1103754532_791906178&CSRFToken=8687482b73766e6d88494351e4ee362f118d103d36d93e2855a79056449754f9f8ea5ebe9e96b4673bad22076774ec85d8c7d7f5b4c4cdd3bd577f2921ee7eab&page=login&action=login_post&email=info%40mydomain.com&password=password: undefined","Global") set(#csrfName,$find regular expression(#input,"(?<=CSRFName\\=).*?(?=&)"),"Global") set(#csrfToken,$find regular expression(#input,"(?<=CSRFToken\\=).*?(?=&)"),"Global") Quote Link to post Share on other sites
quickregister 1 Posted December 10, 2017 Author Report Share Posted December 10, 2017 Thank you. Your addition worked. However, I had given you the wrong information to make the regex code from.I got the info from the http headers but I really needed to get it from the html source code. So the code that worked for one of the variables ended up being. (?<=CSRFName\'\ value\=\').*(?=\'\ \/\>) Because I needed to take it from here: <input type='hidden' name='CSRFName' value='CSRF1103754532_1655122622' />Also, I sent you an email about your regex builder which I just bought. I noticed that there was not a place for "target" as in the videos. Is there another way I can define the target using the software? Thank you for your help. I really appreciate it! Matt Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.