the string read from the file is below
reject tcp any any -> any any (content:"twitter.com";msg:"TWITTER1 BEING ACESSED";sid:41325;rev:001
QRegExp re
("(\\w*) tcp (\\w*) any -> any any \\(content:((\"([A-Za-z0-9_\\./\\-$\\s]*)\"));msg:((\"([A-Za-z0-9_\\./\\-$\\s]*)\"));sid:(\\w*);");
while((pos=re.indexIn(str, pos))!=-1){
list << re.cap(1);//gives first field from string
list << re.cap(2);//gives 3rd field
list << re.cap(3);//gives content
list << re.cap(6);//gives msg
list << re.cap(9);//gives sid
pos+=re.matchedLength();
}
QRegExp re("(\\w*) tcp (\\w*) any -> any any \\(content:((\"([A-Za-z0-9_\\./\\-$\\s]*)\"));msg:((\"([A-Za-z0-9_\\./\\-$\\s]*)\"));sid:(\\w*);");
while((pos=re.indexIn(str, pos))!=-1){
list << re.cap(1);//gives first field from string
list << re.cap(2);//gives 3rd field
list << re.cap(3);//gives content
list << re.cap(6);//gives msg
list << re.cap(9);//gives sid
pos+=re.matchedLength();
}
To copy to clipboard, switch view to plain text mode
The above regex gives me reject, any, twitter.com, twitter being accessed, 41325
but for that i have to choose 1,2,3,6,9 fields out of the re.cap coz the line has multiple line of quotes.
but the same doesn't work for the below string
alert tcp 192.168.1.9 any -> any any (content:"www.gmail.com";msg:"gmail being ACCESSED";sid:41330;rev:001
please help
Bookmarks