Hi, we're trying to find out windows XP users with some rules:
- if mod=syn, get client ip (cli)
- if mod=syn+ack, get server ip (server)
- For each ip, regard as Windows XP if over 80% of OS shows os="Windows XP"
Logs look like following:
[2014/05/19 10:40:01] mod=syn|cli=192.168.133.251/36360|srv=192.168.188.98/80|subj=cli|os=Windows NT kernel 5.x|dist=5|params=generic fuzzy|raw_sig=4:59+5:0:1460:65535,8:mss,nop,ws,nop,nop,sok:df,id+:0 [2014/05/19 10:35:28] mod=syn+ack|cli=192.168.94.71/49771|srv=192.168.11.122/80|subj=srv|os=Windows 7 or 8|dist=3|params=none|raw_sig=4:125+3:0:1460:8192,8:mss,nop,ws,sok,ts:df,id+:0
I use following search which seems to be a bit clumsy (I'm newbie to Splunk) and I'm finding the way to verify it:
search sourcetype=p0f ( mod=syn ) | rename cli AS ipaddr | fields mod, os, ipaddr
| append [ search sourcetype=p0f (mod="syn+ack" ) | rename srv AS ipaddr | fields mod, os, ipaddr ]
| rex mode=sed field=ipaddr "s/\/.*//g"
| stats count, count(eval(match(os,"Windows XP"))) as XP, count(eval(NOT match(os, "Windows XP"))) as nonXP by ipaddr
| eval matched = XP/count * 100 | search matched >= 80 | fields ipaddr ]
I wonder if this can be achieved more efficiently. Would anyone please help? Thanks a lot.
Rgds