[This example is code from a book I am writing to be titled "Powershell: Logic, Syntax, and Semantics". All rights for the code below are reserved.]
I am working with how other security software works with Powershell. This is nping 0.6.40:
sl "C:\Program Files (x86)\Nmap"
[ARRAY]$Array=foreach ($i in $e) {
$a = nping -q -H -c 10 --tcp -p 443 $i;
[ARRAY]$b = ($a[2] -replace(" ","`r`n") | findstr 'ms') -replace("ms","");
New-object PSObject -Property @{
HOST = $i
MAX = [FLOAT]$b[0];
MIN = [FLOAT]$b[1];
AVG = [FLOAT]$b[2];
}
}
$Array | Select HOST,MAX,MIN,AVG | sort AVG | ft -auto
HOST MAX MIN AVG
---- --- --- ---
rmfmedia.com 272 156 204.452
rmfnetworksecurity.com 418 168 241.996
rmfdevelopment.com 444 170 249.843
No comments:
Post a Comment