Skip to content

Instantly share code, notes, and snippets.

View cisterni's full-sized avatar

Antonio Cisternino cisterni

View GitHub Profile
@cisterni
cisterni / GetHashCheck.ps1
Last active July 1, 2022 18:08
Compute file hash and generate script check
function Get-HashCheck {
[CmdletBinding()]
Param([Parameter(ValueFromPipeline)]$o)
process {
Write-Output "File: $([System.IO.FileInfo]::new($o.Path).Name)"; Write-Output ''
Write-Output ($o | select Algorithm, Hash)
Write-Output ''
Write-Output ('Get-FileHash -Algorithm SHA256 .\' + ([System.IO.FileInfo]::new($o.Path).Name) + ' |% { if ($_.Hash -eq "' + ($o.Hash) + '") { Write-Output "Test $([System.IO.FileInfo]::new($_.Path).Name) OK" } else { Write-Output "Test $([System.IO.FileInfo]::new($_.Path).Name) KO" }}')
}
}
@cisterni
cisterni / TLSCert.ps1
Last active March 5, 2021 10:03
TLS Certificate test in powershell core
function Test-WebServerCertificate {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)]
[string]$URL,
[Parameter(Position = 1)]
[ValidateRange(1,65535)]
[int]$Port = 443,
[Parameter(Position = 2)]
[Net.WebProxy]$Proxy,