mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-02 03:06:47 +00:00
4b4f811735
* Add Base/Delta to .travis.yml * Implement Delta system test. * Removed un-needed scripts. * Update system_test_Driver.py
28 lines
820 B
Python
28 lines
820 B
Python
# Add faulty components to the PACCOR generated JSON componentsFile.
|
|
# This will be used to create a bad platform certificate.
|
|
|
|
import json
|
|
|
|
print("Adding Faulty components...")
|
|
|
|
try:
|
|
nicComponent = '00090002'
|
|
pc_dir = '/var/hirs/pc_generation/'
|
|
|
|
with open(pc_dir + "componentsFile", "r") as f:
|
|
|
|
data = json.load(f)
|
|
print(data)
|
|
components = data['COMPONENTS']
|
|
for component in components:
|
|
if component['COMPONENTCLASS']['COMPONENTCLASSVALUE'] == nicComponent:
|
|
print("Creating FAULTY component for: " + component['MODEL'])
|
|
component['MODEL'] += "-FAULTY"
|
|
print("New JSON value: " + component['MODEL'])
|
|
|
|
with open(pc_dir + "PBaseCertB.json", 'w') as outfile:
|
|
json.dump(data, outfile)
|
|
|
|
except Exception as ex:
|
|
print "=== ERROR generating PBaseCertB.json ===: error({0})".format(ex.message)
|