Skip to content

Commit

Permalink
Merge pull request #91 from nsacyber/issue/90
Browse files Browse the repository at this point in the history
[#90] Fixed issue with empty serial number string resulting in corrupted JSON data.
  • Loading branch information
iadgovuser29 committed Aug 3, 2020
2 parents 7c4e76b + a8efe00 commit ca80d79
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 292 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ospackage {
os=LINUX
arch=NOARCH
version='1.1.4'
release='2'
release='3'

into '/opt/paccor'
user 'root'
Expand Down
22 changes: 20 additions & 2 deletions scripts/windows/allcomponents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,14 @@ function parseCpuData() {

if (![string]::IsNullOrEmpty($tmpSerial) -and ($tmpSerial.Trim().Length -ne 0)) {
$tmpSerial=(jsonSerial "$tmpSerial".Trim())
} else {
$tmpSerial=""
}

if (![string]::IsNullOrEmpty($tmpRevision) -and ($tmpRevision.Trim().Length -ne 0)) {
$tmpRevision=(jsonRevision "$tmpRevision".Trim())
} else {
$tmpRevision=""
}

if ("$tmpUpgradeMethod" -eq "$processorNotUpgradableIndicator") {
Expand Down Expand Up @@ -549,10 +553,14 @@ function parseRamData() {

if (![string]::IsNullOrEmpty($tmpSerial) -and ($tmpSerial.Trim().Length -ne 0)) {
$tmpSerial=(jsonSerial "$tmpSerial".Trim())
} else {
$tmpSerial=""
}

if (![string]::IsNullOrEmpty($tmpRevision) -and ($tmpRevision.Trim().Length -ne 0)) {
$tmpRevision=(jsonRevision "$tmpRevision".Trim())
} else {
$tmpRevision=""
}
$tmpComponent=(jsonComponent $ramClass $tmpManufacturer $tmpModel $replaceable $tmpSerial $tmpRevision)
$component+="$tmpComponent,"
Expand Down Expand Up @@ -608,11 +616,15 @@ function parseNicData() {

if (![string]::IsNullOrEmpty($tmpSerialConstant) -and ($tmpSerialConstant.Trim().Length -ne 0)) {
$tmpSerial=(jsonSerial "$tmpSerialConstant".Trim())
} else {
$tmpSerial=""
}


if (![string]::IsNullOrEmpty($tmpRevision) -and ($tmpRevision.Trim().Length -ne 0)) {
$tmpRevision=(jsonRevision "$tmpRevision".Trim())
} else {
$tmpRevision=""
}

if ($tmpMediaType -and $tmpSerial) {
Expand Down Expand Up @@ -688,10 +700,14 @@ function parseHddData() {

if (![string]::IsNullOrEmpty($tmpSerial) -and ($tmpSerial.Trim().Length -ne 0)) {
$tmpSerial=(jsonSerial "$tmpSerial".Trim())
} else {
$tmpSerial=""
}

if (![string]::IsNullOrEmpty($tmpRevision) -and ($tmpRevision.Trim().Length -ne 0)) {
$tmpRevision=(jsonRevision "$tmpRevision".Trim())
} else {
$tmpRevision=""
}

$tmpComponent=(jsonComponent $hddClass $tmpManufacturer $tmpModel $replaceable $tmpSerial $tmpRevision)
Expand All @@ -717,7 +733,7 @@ function parseGfxData() {
for($i=0;$i -lt $numRows;$i++) {
Write-Progress -Id 2 -ParentId 1 -Activity "Gathering Graphics information" -CurrentOperation ("Cleaning output for HDD " + ($i+1)) -PercentComplete ((($i+1) / $numRows) * 100)

$hddClass=(jsonComponentClass "$COMPCLASS_REGISTRY_TCG" "$COMPCLASS_GFX")
$gfxClass=(jsonComponentClass "$COMPCLASS_REGISTRY_TCG" "$COMPCLASS_GFX")

$pnpDevID=""
if(isPCI($RS[$i].PNPDeviceID)) {
Expand All @@ -743,9 +759,11 @@ function parseGfxData() {

if (![string]::IsNullOrEmpty($tmpRevision) -and ($tmpRevision.Trim().Length -ne 0)) {
$tmpRevision=(jsonRevision "$tmpRevision".Trim())
} else {
$tmpRevision=""
}

$tmpComponent=(jsonComponent $hddClass $tmpManufacturer $tmpModel $replaceable $tmpRevision)
$tmpComponent=(jsonComponent $gfxClass $tmpManufacturer $tmpModel $replaceable $tmpRevision)
$component+="$tmpComponent,"
}

Expand Down
Loading

0 comments on commit ca80d79

Please sign in to comment.