If your organization runs Splunk, you can bring the file signals from the NetClean reference script into Splunk with the Splunk Universal Forwarder, and analyze the hashes with the File Analysis connector for Splunk. This article explains what the connector needs, and how to forward the reference script's events.
This article is based on Splunk's published documentation for the Universal Forwarder and on the event format of NetClean's reference script. The script is provided as an example, and NetClean does not provide support for implementing, modifying or operating it in your environment. Configuration details should be confirmed against your own Splunk environment and with Splunk.
The setup
The reference script hashes media files on your Windows devices and writes the results as events to the Windows Application log. The Universal Forwarder reads those events and sends them to Splunk, where the connector submits the SHA-1 hashes to the File Analysis API.
Reference script → Windows Application log → Universal Forwarder → Splunk → File Analysis connector → match/no match
The hashing happens on the device, in the script. The Universal Forwarder only reads and forwards the events.
What this gives you
This approach surfaces file presence: media files found on the device when the script runs. It does not show that a file was opened or viewed, which is the layer Workstation Event Screening in ProActive is built to see. It uses the Splunk Universal Forwarder you may already run, so the script's events travel in the same way as your other Windows logs.
What the connector needs
These requirements are the minimum, and they apply whatever produces your hashes:
- SHA-1 hash values in a field in the search results, one hash per result.
- API credentials configured in the connector. See "File Analysis connector for Splunk".
We also recommend keeping contextual information in the search results, such as the host name, user name, file path and source system, so that you can correlate and follow up on results in Splunk. Only the hashes are submitted for analysis. Any source that puts SHA-1 values into Splunk works in the same way, whether or not it uses the reference script.
What setting this up generally involves
- Deploy the reference script so that it writes events to the Application log. See "Collecting file signals with a PowerShell reference script".
- Install the Universal Forwarder on the Windows devices. To read all local event logs, it must run as the Local System user. See Splunk's documentation on monitoring Windows event logs.
- Add an input for the Application log on the forwarder that only forwards the script's events, and send them to an index of your choice.
- Check that the events arrive in Splunk.
- Create a search that returns one SHA-1 hash per result, and connect it to the connector's alert action. See "File Analysis connector for Splunk".
- Define what happens on a match. See "Responding to human insider risk matches and alerts".
Details
At a glance
- Collection method: script-based collection, with the Splunk Universal Forwarder as collector
- Collection mode: scheduled or on-demand, as the script
- Delivery path: via local log and collector
- Visible signal: file presence
- OS coverage: Windows (Windows PowerShell 5.1)
- Hash algorithms: SHA-1
- Where credentials live: in the Splunk connector, never on endpoints
What the reference script writes
- Event source: NetClean-FileAnalysis, in the Application log
- Event 4100: file events, as JSON, with up to 40 files per event. Event 4101 is a summary of each run, and event 4199 is an error.
- For each file: SHA-1, size, and created and modified time. Filename, path and user profile are added only if you turn on the personal data fields in the script.
- For each run: device name, device ID, OS version, script version and run ID.
The forwarder input
Splunk can filter Windows event log inputs on the source name of the event. A stanza like this in the forwarder's inputs.conf forwards only the script's events from the Application log:
[WinEventLog://Application] disabled = 0 index = <your index> whitelist = SourceName="^NetClean-FileAnalysis$"
Configure this on the forwarder, where the input runs. See Splunk's inputs.conf reference for the filter format.
Illustrative search
The files in an event are in a list in the event message. An illustrative search that returns one hash per result looks like this. The field names depend on how your forwarder and Splunk are configured, so adjust it to your environment.
index=<your index> SourceName="NetClean-FileAnalysis" EventCode=4100
| spath input=Message path=files{}.sha1 output=sha1
| mvexpand sha1
| dedup sha1
| table sha1, hostIf you set the script's ChunkSize to 1, every event contains a single file, and the search becomes simpler. The cost is more events.
Volume and limits
- In the script's default mode, only new or changed files are sent, so repeated runs don't resend the same hashes.
- The Application log is shared with other software. Check its size and retention in your environment, so that events aren't overwritten before the forwarder reads them.
- Remove duplicates in the search within a time window that suits your schedule.
Limitations
- The reference script covers Windows only.
- Results reflect files present when the script runs, not a continuous event stream.
- The limitations of the script itself apply. See "Collecting file signals with a PowerShell reference script".