paddie / SOxServer

Server for the SOxClient
2 stars 0 forks source link

Simplify the collection of machine data.. #4

Closed paddie closed 12 years ago

paddie commented 12 years ago

python:

>>> import subprocess
>>> import plistlib
>>> info= subprocess.Popen(["/usr/sbin/system_profiler","-xml","SPHardwareDataType"], stdout=subprocess.PIPE).communicate()[0]
>>> plist = plistlib.readPlistFromString(info)
>>> print plist[0]["_items"][0]["serial_number"]
W80362D0ATP
>>> print plist[0]["_items"][0].keys()
['platform_UUID', 'current_processor_speed', 'machine_name', 'SMC_version_system', 'number_processors', '_name', 'l2_cache', 'bus_speed', 'machine_model', 'cpu_type', 'MMM_entry', 'serial_number', 'boot_rom_version', 'packages', 'physical_memory']
paddie commented 12 years ago

Which would also ad a fair bit of resolution to the information gathered from each machine..

paddie commented 12 years ago

Done!