Skip to content

Commit

Permalink
Merge pull request #108 from nsacyber/further-status-scripts
Browse files Browse the repository at this point in the history
Added JSON Status Keywords
  • Loading branch information
iadgovuser29 authored Jan 3, 2023
2 parents 7690ec4 + 5be8e2c commit 0997502
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scripts/allcomponents.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ JSON_HASHVALUE="HASHVALUE"
JSON_NAME="NAME"
JSON_VALUE="VALUE"
JSON_PROP_STATUS="STATUS"
#### JSON Status Keywords
JSON_STATUS_ADDED="ADDED"
JSON_STATUS_MODIFIED="MODIFIED"
JSON_STATUS_REMOVED="REMOVED"
NOT_SPECIFIED="Not Specified"


Expand Down Expand Up @@ -804,7 +808,7 @@ parseGfxData () {

### Gather property details
property1=$(jsonProperty "uname -r" "$(uname -r)") ## Example1
property2=$(jsonProperty "OS Release" "$(grep 'PRETTY_NAME=' /etc/os-release | sed 's/[^=]*=//' | sed -e 's/^[[:space:]\"]*//' | sed -e 's/[[:space:]\"]*$//')" "samplestatus") ## Example2
property2=$(jsonProperty "OS Release" "$(grep 'PRETTY_NAME=' /etc/os-release | sed 's/[^=]*=//' | sed -e 's/^[[:space:]\"]*//' | sed -e 's/[[:space:]\"]*$//')") # "$JSON_STATUS_ADDED") ## Example2 with optional third status argument

### Collate the component details
componentsCPU=$(parseCpuData)
Expand Down
6 changes: 5 additions & 1 deletion scripts/windows/allcomponents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ $JSON_HASHVALUE="HASHVALUE"
$JSON_NAME="NAME"
$JSON_VALUE="VALUE"
$JSON_PROP_STATUS="STATUS"
#### JSON Status Keywords
$JSON_STATUS_ADDED="ADDED"
$JSON_STATUS_MODIFIED="MODIFIED"
$JSON_STATUS_REMOVED="REMOVED"
$NOT_SPECIFIED="Not Specified"


Expand Down Expand Up @@ -862,7 +866,7 @@ $componentArray=(jsonComponentArray "$componentChassis" "$componentBaseboard" "$
Write-Progress -Id 1 -Activity "Gathering properties" -PercentComplete 80
$osCaption=((wmic os get caption /value | Select-String -Pattern "^.*=(.*)$").Matches.Groups[1].ToString().Trim())
$property1=(jsonProperty "caption" "$osCaption") ## Example1
$property2=(jsonProperty "caption" "$osCaption" "samplestatus") ## Example2 (including optional status field)
$property2=(jsonProperty "caption" "$osCaption") # "$JSON_STATUS_ADDED") ## Example2 with optional third status argument

### Collate the property details
$propertyArray=(jsonPropertyArray "$property1" "$property2")
Expand Down

0 comments on commit 0997502

Please sign in to comment.