Skip to content

Instantly share code, notes, and snippets.

@joenorton8014
Created July 30, 2018 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joenorton8014/0fb927c117f8499ad991ff7c96e2392d to your computer and use it in GitHub Desktop.
Save joenorton8014/0fb927c117f8499ad991ff7c96e2392d to your computer and use it in GitHub Desktop.
$users = Get-ChildItem "c:\users" | Select-Object name
$users | ForEach-Object {
$user = $($_.Name)
$iocfile = "C:\Users\$($_.Name)\AppData\Roaming\somemalwarefile.tmp"
if (Test-Path $iocfile){
$filehash = get-filehash $iocfile | Select-Object -ExpandProperty hash
$searchresults = "File found!"
}
else {
$filehash = "No file to hash"
$searchresults = "IOC not found"
}
$thiscomputer = [system.environment]::MachineName
"$user,$thiscomputer,$searchresults,$filehash"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment