Question

I'm asked to create 'worm' as for my homework assignment. I got everything working by using SID but when I try to copy SID by using Regex I get NULL result and can't figure out why. This code does copy itself to new thread but can't find the SID for some reason.

In first screenshot we can see the code I have that create a new post and additional code that copies entire code. The selected (orange part is what I'm having problem with) is what I don't understand why it wouldn't work. As I am using HTML encoding I cannot use plus signs this is why I am trying to use concat function. Also, the Regex expression I'm using have worked correctly as far I did some testing.

enter image description here

In this screen shot we can see that the result where I perform Regex returns NULL.

enter image description here

Any ideas?

Small note, this is my homework assignment and we are exploiting specially modified phpBB forums which allows code injection (JavaScript).

Not sure if this is the right SO section to post, please say so if I should move.

Was it helpful?

Solution

match returns an array of matches. xx[0] will have the full match, but if you want just the SID then you should do

/sid=([^;]+)/

and .concat(xx[1]).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top