Skip to content

Instantly share code, notes, and snippets.

@haircut
Created November 30, 2017 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haircut/a200be663d074d7d732c89829c6983ae to your computer and use it in GitHub Desktop.
Save haircut/a200be663d074d7d732c89829c6983ae to your computer and use it in GitHub Desktop.
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
Copy link
Author

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