if
(
windows of operating system
)
then
(
(
value "InstallDate" of keys whose
(
value "DisplayName" of it = "Carbon Black Sensor"
)
of key "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of registry as string
)
| "n/a"
)
else if
(
(
exists match
(
regex "Linux CentOS (6|7)"
)
of name of operating system
)
OR
(
(
name of operating system starts with "Linux Red Hat"
)
AND
(
exists file "/etc/redhat-release" whose
(
exists line whose
(
exists match
(
regex "Red Hat Enterprise Linux (Client|Server|Workstation) release 6|7"
)
of it
)
of it
)
AND NOT exists file "/etc/vmware-release" whose
(
exists line whose
(
it contains "VMware ESX"
)
of it
)
AND NOT exists file "/etc/enterprise-release" whose
(
exists line whose
(
it contains "Enterprise Linux Enterprise Linux"
)
of it
)
)
)
)
then
(
(
year of it as string &
(
if month of it as integer < 10 then "0" & month of it as integer as string else month of it as integer as string
)
&
(
if day_of_month of it as integer < 10 then "0" & day_of_month of it as string else day_of_month of it as string
)
)
of date
(
local time zone
)
of modification time of folder "/opt/cbsensor"
)
else "n/a"
if (windows of operating system) then ((value "InstallDate" of keys whose (value "DisplayName" of it = "Carbon Black Sensor") of key "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of registry as string) | "n/a") else if ((exists match (regex "Linux CentOS (6|7)") of name of operating system) OR ((name of operating system starts with "Linux Red Hat") AND (exists file "/etc/redhat-release" whose (exists line whose (exists match (regex "Red Hat Enterprise Linux (Client|Server|Workstation) release 6|7") of it) of it) AND NOT exists file "/etc/vmware-release" whose (exists line whose (it contains "VMware ESX") of it) AND NOT exists file "/etc/enterprise-release" whose (exists line whose (it contains "Enterprise Linux Enterprise Linux") of it)))) then ((year of it as string & (if month of it as integer < 10 then "0" & month of it as integer as string else month of it as integer as string) & (if day_of_month of it as integer < 10 then "0" & day_of_month of it as string else day_of_month of it as string)) of date (local time zone) of modification time of folder "/opt/cbsensor") else "n/a"