Difference between revisions of "Tanium Custom Sensors"

From RiceFamily Wiki
Jump to: navigation, search
 
Line 16: Line 16:
  
 
Current release of Python used in Tanium : 3.1.2
 
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))

Latest revision as of 04:57, 10 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))