Hi, Monks.

I have a task to parse line, containing XSS vulnerability string and find a vulnerable file in it. Here some examples:

my @vulnerabilities = qw( http://www.parismatch.com/recherche/recherche?motcle="%2F><marquee +>xss+death-angel<iframe+src%3D"htt p%3A%2F%2Fwww.xssed.com"%2F>&x=5&y=6 https://www.simplydomains.co.nz/register.php/ref="><script>alert(1 +);</script> https://www.simplydomains.co.nz/logon/ref="><script>alert(1);</scr +ipt> https://www.eso.shell.com/eso/e_invoice_jsp/req_form_uk2.jsp?coun +trycode=18&language=%22%3E%3Cscript%3Ealert(%22daimon%22)%3C/script%3 +E ); foreach my $vuln (@vulnerabilities) { my ($file) = $vuln =~ m{^/.*?([^/]+)[\?/]}; print $file, "\n"; }

So the correct list for me is:

recherche register.php logon req_form_uk2.jsp

The main problem for me is to find where mod_rewrite stuff starts (where ? changed with /). How i can find it? May be i need several regex?

Thanks.
Roman


In reply to Need help with regex/strategy by Gangabass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.