Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Integrity Check to "Initialize USB Storage" #76

Open
maltfield opened this issue Feb 13, 2024 · 0 comments
Open

Add Integrity Check to "Initialize USB Storage" #76

maltfield opened this issue Feb 13, 2024 · 0 comments

Comments

@maltfield
Copy link
Member

maltfield commented Feb 13, 2024

This ticket will track the effort to update the Initialize USB Storage process to include integrity checks when provisioning a USB drive with the BusKill software.

This was skipped in the initial ticket because it's non-trivial to execute something like sha256sum -c recursively on a directory in Windows.

Today we got a question answered on SE that may address that:

Create the digest file

Run the following command on Windows to generate a sha256sums file (in fact, we won't be doing this as the file is generated in linux).

Get-ChildItem -Recurse -Exclude sha256sums | Get-FileHash -Algorithm SHA256
| % {$_.Hash + "  " + (Resolve-Path -Path $_.Path -Relative)} | Out-File
-FilePath sha256sums -Encoding utf8NoBOM

Verify the digest file

Run this command on Windows to recursively verify the integrity of a sha256sums digest file

Get-Content -Path sha256sums | % {$Hash, $_, $File = $_.Split(" ", 3); if
($Hash) { [PSCustomObject]@{Path=$File; Result=if ((Get-FileHash -Path
$File -Algorithm SHA256).Hash -eq $Hash) { "OK" } else { "FAILED" }}}} |
Format-List

I've not verified the efficacy of the above command at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant