As a follow up to yesterday's how-to, I thought hashing might a thing to cover. We use hashes all the time, but it's annoying that md5sum, sha1sum and sha256sum aren't part of the windows command set - or are they? Yup, it turns out that they most definitely are part of PowerShell: Get-FileHash -path $filename -Algorithm $algo Where the Algorithm is a string, any one of:
But what about string values? If you want to hash a string, there doesn't seem to be a function for that. It turns out that while it's not part of PowerShell as a separate thing, it's pretty easy to access it using the string as an "inputstring" variable:
So, this gets the job done but it's a bit cludgy, let's drop it into a function, then call the function:
This "common infosec functions in PowerShell" thing kinda got started by accident, and got extended when Jim Clausing asked me if I was going to re-write CyberChef in PowerShell?. Of course my answer was "If you're going to put down a dare like that, challenge accepted" - so look for more stories of this type in future. As I introduce more functions, I'll roll them into the same GUI as I presented yesterday, code will get updated in my github ( https://github.com/robvandenbrink ). =============== |
Rob VandenBrink 578 Posts ISC Handler May 15th 2020 |
|||
Thread locked Subscribe |
May 15th 2020 2 years ago |
Sign Up for Free or Log In to start participating in the conversation!