Difference between revisions of "Tanium Custom Sensors"

From RiceFamily Wiki
Jump to: navigation, search
Line 33: Line 33:
 
   except Exception as e:
 
   except Exception as e:
 
   tanium.results.add("Error executing sensor: {}".format(e))
 
   tanium.results.add("Error executing sensor: {}".format(e))
 +
 +
 +
[[Category:Tanium]]
 +
[[Category:Work]]

Revision as of 13:54, 14 May 2025

Tanium Sensors are how we pull data back about Endpoints.

They can be written with VBS, PowerShell or Python.

Python works on both Windows, Linux, and Mac so it is the preferred method of writing Custom Sensors.

Links


Python Executable path : C:\Program Files (x86)\Tanium\Tanium Client\TPython312\TPython.bat

Python Executables : ``C:\Program Files (x86)\Tanium\Tanium Client\python312``

Current release of Python used in Tanium : 3.1.2


 "exec" "env" "TANIUM_SENSOR=1" "'pwd'/'if [ -f TPython ]; then echo TPython/TPython; else echo python27/python; fi'" "$0" "$@"
 inport tanium
 import tanium.host
 
 SENSOR_DELIMITER = '|'
 
 def do_stuff():
 	comp_name = tanium.host.get_hostname()
 	answer = "{hello}{sep}{name}.format(hello="Hello", sep=SENSOR_DELIMETER, name=comp_name)
 	tanium.results.add(answer)
 	
 try:
 	do_stuff()
 except Exception as e:
 	tanium.results.add("Error executing sensor: {}".format(e))