Beispiel #1
0
def report_webkit_version():
    path = ctypes.macholib.dyld.framework_find('JavaScriptCore')
    if not path:
        return
    bundle = NSBundle.bundleWithPath_(os.path.dirname(path))
    if bundle is None:
        return
    version = bundle.infoDictionary()['CFBundleVersion']
    report('webkit-version', version=version)
Beispiel #2
0
def get_marketing_name():
    # get_marketing_name gets the marketing name for the model of the Mac
    # in the form of '13" MacBook Pro with Retina display (Early 2015)'
    ServerInformation = NSBundle.bundleWithPath_(
        '/System/Library/PrivateFrameworks/ServerInformation.framework')
    ServerCompatibility = NSBundle.bundleWithPath_(
        '/System/Library/PrivateFrameworks/ServerCompatibility.framework')

    ServerInformationComputerModelInfo = ServerInformation.classNamed_(
        'ServerInformationComputerModelInfo')
    SVCSystemInfo = ServerCompatibility.classNamed_('SVCSystemInfo')

    info = SVCSystemInfo.currentSystemInfo()
    extended_info = ServerInformationComputerModelInfo.attributesForModelIdentifier_(
        info.computerModelIdentifier())

    if extended_info:
        marketing_name = extended_info['marketingModel']
        return marketing_name
    else:
        return "-"
Beispiel #3
0
def MachineName():
	if platform.system() == 'Linux':
		
		cpu = ''
		itemsUsed = []
		procinfo = Execute('cat /proc/cpuinfo')

		for line in procinfo.split('\n'):
			if ':' in line:
				k, v = line.split(':')[:2]
				if k.strip() == 'model name' and not k in itemsUsed:
					cpu += v.strip()
					itemsUsed.append(k)
		return '%s %s with %s' % (Execute('cat /sys/devices/virtual/dmi/id/sys_vendor'), Execute('cat /sys/devices/virtual/dmi/id/product_name'), cpu)

	elif platform.system() == 'Darwin':

		name = None


		# Approach 1
		import sys
		import plistlib
		import subprocess
		from Cocoa import NSBundle
		data = plistlib.readPlistFromString(Execute('system_profiler -xml SPHardwareDataType'))

		if (len(sys.argv) == 2):
			model = sys.argv[1]
		else:
			model = subprocess.check_output(["/usr/sbin/sysctl", "-n", "hw.model"]).strip()

		serverInfoBundle=NSBundle.bundleWithPath_("/System/Library/PrivateFrameworks/ServerInformation.framework/")
		sysinfofile=serverInfoBundle.URLForResource_withExtension_subdirectory_("SIMachineAttributes", "plist", "")

		plist = plistlib.readPlist(sysinfofile.path())

		if (model in plist):
			name = plist[model]["_LOCALIZABLE_"]["marketingModel"]

		# Approach 2
		if not name:
			name = data[0]['_items'][0]['machine_name']


		return 'Apple %s (%s) with %s %s, %s memory' % (name, data[0]['_items'][0]['machine_model'], data[0]['_items'][0]['cpu_type'], data[0]['_items'][0]['current_processor_speed'], data[0]['_items'][0]['physical_memory'])
Beispiel #4
0
def fact():
    """Returns the marketing name"""
    result = "None"
    model = subprocess.check_output(["/usr/sbin/sysctl", "-n",
                                     "hw.model"]).strip()

    serverInfoBundle = NSBundle.bundleWithPath_(
        "/System/Library/PrivateFrameworks/ServerInformation.framework/")
    sysinfofile = serverInfoBundle.URLForResource_withExtension_subdirectory_(
        "SIMachineAttributes", "plist", "")

    d = plistlib.readPlist(sysinfofile.path())

    if d.get(model, False):
        result = d[model]["_LOCALIZABLE_"]["marketingModel"]

    return {factoid: result.strip()}
Beispiel #5
0
def fact():
    '''Returns the marketing name'''
    result = 'None'
    model = subprocess.check_output(
            ['/usr/sbin/sysctl', '-n', 'hw.model']
            ).strip()

    serverInfoBundle = NSBundle.bundleWithPath_(
            '/System/Library/PrivateFrameworks/ServerInformation.framework/'
            )
    sysinfofile = serverInfoBundle.URLForResource_withExtension_subdirectory_(
            'SIMachineAttributes', 'plist', ''
            )

    d = plistlib.readPlist(sysinfofile.path())

    if d.get(model, False):
        result = d[model]['_LOCALIZABLE_']['marketingModel']

    return {factoid: result.strip()}