mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Include Chrome device TPM info
This commit is contained in:
17
src/gam.py
17
src/gam.py
@@ -9139,9 +9139,14 @@ def doGetCrosInfo():
|
|||||||
print u'CrOS Device: {0} ({1} of {2})'.format(deviceId, i, device_count)
|
print u'CrOS Device: {0} ({1} of {2})'.format(deviceId, i, device_count)
|
||||||
if u'notes' in cros:
|
if u'notes' in cros:
|
||||||
cros[u'notes'] = cros[u'notes'].replace(u'\n', u'\\n')
|
cros[u'notes'] = cros[u'notes'].replace(u'\n', u'\\n')
|
||||||
|
cros = _checkTPMVulnerability(cros)
|
||||||
for up in CROS_SCALAR_PROPERTY_PRINT_ORDER:
|
for up in CROS_SCALAR_PROPERTY_PRINT_ORDER:
|
||||||
if up in cros:
|
if up in cros:
|
||||||
|
if isinstance(cros[up], basestring):
|
||||||
print u' {0}: {1}'.format(up, cros[up])
|
print u' {0}: {1}'.format(up, cros[up])
|
||||||
|
else:
|
||||||
|
sys.stdout.write(u' %s:' % up)
|
||||||
|
print_json(None, cros[up], u' ')
|
||||||
if not noLists:
|
if not noLists:
|
||||||
activeTimeRanges = _filterTimeRanges(cros.get(u'activeTimeRanges', []), startDate, endDate)
|
activeTimeRanges = _filterTimeRanges(cros.get(u'activeTimeRanges', []), startDate, endDate)
|
||||||
lenATR = len(activeTimeRanges)
|
lenATR = len(activeTimeRanges)
|
||||||
@@ -10863,6 +10868,16 @@ def doPrintCrosActivity():
|
|||||||
csvRows.append(row)
|
csvRows.append(row)
|
||||||
writeCSVfile(csvRows, titles, u'CrOS Activity', todrive)
|
writeCSVfile(csvRows, titles, u'CrOS Activity', todrive)
|
||||||
|
|
||||||
|
def _checkTPMVulnerability(cros):
|
||||||
|
if u'tpmVersionInfo' in cros and u'firmwareVersion' in cros[u'tpmVersionInfo']:
|
||||||
|
if cros[u'tpmVersionInfo'][u'firmwareVersion'] in CROS_TPM_VULN_VERSIONS:
|
||||||
|
cros[u'tpmVersionInfo'][u'tpmVulnerability'] = u'VULNERABLE'
|
||||||
|
elif cros[u'tpmVersionInfo'][u'firmwareVersion'] in CROS_TPM_FIXED_VERSIONS:
|
||||||
|
cros[u'tpmVersionInfo'][u'tpmVulnerability'] = u'UPDATED'
|
||||||
|
else:
|
||||||
|
cros[u'tpmVersionInfo'][u'tpmVulnerability'] = u'NOT VULNERABLE'
|
||||||
|
return cros
|
||||||
|
|
||||||
def doPrintCrosDevices():
|
def doPrintCrosDevices():
|
||||||
cd = buildGAPIObject(u'directory')
|
cd = buildGAPIObject(u'directory')
|
||||||
todrive = False
|
todrive = False
|
||||||
@@ -10985,6 +11000,8 @@ def doPrintCrosDevices():
|
|||||||
all_cros = callGAPIpages(cd.chromeosdevices(), u'list', u'chromeosdevices', page_message=page_message,
|
all_cros = callGAPIpages(cd.chromeosdevices(), u'list', u'chromeosdevices', page_message=page_message,
|
||||||
query=query, customerId=GC_Values[GC_CUSTOMER_ID], projection=projection, orgUnitPath=orgUnitPath,
|
query=query, customerId=GC_Values[GC_CUSTOMER_ID], projection=projection, orgUnitPath=orgUnitPath,
|
||||||
orderBy=orderBy, sortOrder=sortOrder, fields=fields, maxResults=GC_Values[GC_DEVICE_MAX_RESULTS])
|
orderBy=orderBy, sortOrder=sortOrder, fields=fields, maxResults=GC_Values[GC_DEVICE_MAX_RESULTS])
|
||||||
|
for cros in all_cros:
|
||||||
|
cros = _checkTPMVulnerability(cros)
|
||||||
if (not noLists) and (not selectActiveTimeRanges) and (not selectRecentUsers):
|
if (not noLists) and (not selectActiveTimeRanges) and (not selectRecentUsers):
|
||||||
for cros in all_cros:
|
for cros in all_cros:
|
||||||
cros.pop(u'deviceFiles', None)
|
cros.pop(u'deviceFiles', None)
|
||||||
|
|||||||
@@ -463,6 +463,7 @@ CROS_ARGUMENT_TO_PROPERTY_MAP = {
|
|||||||
u'tag': [u'annotatedAssetId',],
|
u'tag': [u'annotatedAssetId',],
|
||||||
u'timeranges': [u'activeTimeRanges.activeTime', u'activeTimeRanges.date'],
|
u'timeranges': [u'activeTimeRanges.activeTime', u'activeTimeRanges.date'],
|
||||||
u'times': [u'activeTimeRanges.activeTime', u'activeTimeRanges.date'],
|
u'times': [u'activeTimeRanges.activeTime', u'activeTimeRanges.date'],
|
||||||
|
u'tpmversioninfo': [u'tpmVersionInfo'],
|
||||||
u'user': [u'annotatedUser',],
|
u'user': [u'annotatedUser',],
|
||||||
u'users': [u'recentUsers.email', u'recentUsers.type'],
|
u'users': [u'recentUsers.email', u'recentUsers.type'],
|
||||||
u'willautorenew': [u'willAutoRenew',],
|
u'willautorenew': [u'willAutoRenew',],
|
||||||
@@ -490,6 +491,7 @@ CROS_SCALAR_PROPERTY_PRINT_ORDER = [
|
|||||||
u'lastEnrollmentTime',
|
u'lastEnrollmentTime',
|
||||||
u'orderNumber',
|
u'orderNumber',
|
||||||
u'supportEndDate',
|
u'supportEndDate',
|
||||||
|
u'tpmVersionInfo',
|
||||||
u'willAutoRenew',
|
u'willAutoRenew',
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -498,6 +500,10 @@ CROS_ACTIVE_TIME_RANGES_ARGUMENTS = [u'timeranges', u'activetimeranges', u'times
|
|||||||
CROS_START_ARGUMENTS = [u'start', u'startdate', u'oldestdate']
|
CROS_START_ARGUMENTS = [u'start', u'startdate', u'oldestdate']
|
||||||
CROS_END_ARGUMENTS = [u'end', u'enddate']
|
CROS_END_ARGUMENTS = [u'end', u'enddate']
|
||||||
|
|
||||||
|
# From https://www.chromium.org/chromium-os/tpm_firmware_update
|
||||||
|
CROS_TPM_VULN_VERSIONS = [u'41f', u'420', u'628', u'8520',]
|
||||||
|
CROS_TPM_FIXED_VERSIONS = [u'422', u'62b', u'8521',]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Global variables
|
# Global variables
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user