I try to make a tool that will save only urls with something like this: page_id?id=1'
http://mechanikrolniczy.cba.pl/viewtopic.php?p=16176'
http://all-tubes-jenna-haze.mzs-dgd.ru/index.php?route=product&product_id=9108429'
https://websetnet.net/page/40/?q=%2Fbs%2Fpage%2F40%2F&loginid=117cee5a78'
in the first URL you can see: .php?p=16176' and in the second url product_id=9108429'
and in every URL it can be different...
so I want to use regex to find only words that start with ?something=numberORwords' I have to make sure it ends with '
I have been trying to do it for the past 2 hours, but for some reason I couldn't do it... I even came up with something like this:
^&/]\Wpage_id\W[=0-9]+|\W?item_id\W[=0-9]+|\W?p\W[=0-9]+\Wview\W[=0-9]+\Wno\W[=0-9]+|\Wimage_id\W[=0-9]+|\Wv\W[=0-9]+|\Wsequence\W[=0-9]+|\Wid\W[=0-9]+|\Wstart\W[=0-9]+[']
My code:
string pattern = @"([?][\w]+[=][\w]+)[']";
foreach(string s in urls)
{
Match m = Regex.Match(s, pattern);
if (m.Success)
{
Valid.Add(s);
Console.WriteLine(s);
}
}
Edit: what I try to do is to see if a website has ' at after the parameter it can be vulnerable for SQL injection..