Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check the project build version of opendirectoryd to confirm Security Update 2017-001 is installed
import subprocess
factoid = 'opendirectoryd_version'
def fact():
'''
Returns the "project version" number used to build opendirectoryd
per https://support.apple.com/en-gb/HT208315 to check that
"Security Update 2017-001" is installed
'''
result = 'None'
try:
proc = subprocess.Popen(
['/usr/bin/what', '/usr/libexec/opendirectoryd'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, _ = proc.communicate()
except (IOError, OSError):
stdout = None
if stdout:
result = stdout.splitlines()[-1].split(':')[-1]
return {factoid: result}
if __name__ == '__main__':
print '<result>%s</result>' % fact()[factoid]
@haircut

This comment has been minimized.

Owner

haircut commented Nov 30, 2017

opendirectoryd-483.1.5 on macOS High Sierra 10.13
opendirectoryd-483.20.7 on macOS High Sierra 10.13.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment