Splunk Search

Regex on a Nessus CSV in props.conf

jizzmaster
Path Finder

I have some Nessus vulnerability scanner exports I am trying to properly parse in Splunk. The output is CSV (I know there's an app for Nessus and I have reasons for not using it). I'm grabbing KV pairs via props.conf. However, the OS signature is not extracting well.

What I would like to do is capture the text after "Remote operating system : " until the end of the line.

Here's the relevant props.conf line: EXTRACT-OS = Remote\soperating\ssystem\s:\s(?.*)Confidence

The reason for the "Confidence" word in there is because the regex in props.conf will not work with typical end-of-line notations, like $, or \r\n, or \n. Basically, I'm seeing that props.conf is including line breaks automatically in searches, but not allowing me to use them. This works for most OS signatures except those that list multiple OSes.

Here's a relevant section from the CSV:


Remote operating system : CISCO IOS 15
CISCO IOS 12
Cisco IOS XE
CISCO PIX
Confidence Level : 69
Method : SSH

When I open the original CSV in Notepad++, it shows each line ends with a "LF" (line feed, I believe). And at the very end of all of it, there is an "LF" and a "CR". It seems to treat "$" as the "CR." How do I get my props.conf line to stop reading after the very first "LF", the "CISCO IOS 15" in this specific example?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This works for me using your example data.

Remote\soperating\ssystem\s:\s([\w ]*)
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This works for me using your example data.

Remote\soperating\ssystem\s:\s([\w ]*)
---
If this reply helps you, Karma would be appreciated.
0 Karma

jizzmaster
Path Finder

This worked perfectly. I'm curious as to why, though, especially putting in a space after the \w. I didn't think the pcre would even recognize that, much less use it. And why would the line breaks be included without the \w?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Apparently, there is an implicit (?s) flag (do you have SHOULD_LINEMERGE set?) which means the dot specifier will match line ends. Using [\w ] will match word characters and spaces, but not newlines. You can put any character within brackets (some need to be escaped) and regex will match on them.

Check out regex101 for a great regex test tool.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...