Wednesday, February 04, 2009

the really random password generator (Powershell)

ok,
 
Here is a powershell script I wrote awhile back. thought Id post it.  its a really random password generator:
 
$pwdlength = [int]
$pwdlength = Read-Host "please provide desired password length"
$bytes = [byte[]][byte]1
$pwd = [string]""
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
for($i=1;$i -le $pwdlength;$i++)
{
 $rng.getbytes($bytes)
 $rnd = $bytes[0] -as [int]
 $int = ($rnd % 74) + 48
 $chr = $int -as [char]
 $pwd = $pwd + $chr
}
write $pwd
 
 
enjoy.  
 
 
maybe later, I will modify it to control special characters. or if someone wants to figure it out, I will repost the code.
 
 
 
-Nex6

using powershell to reslove a host name to IP

ok,
 
Here is the best part you'll need:
 
$rs = [System.Net.Dns]::GetHostAddresses($i)|select-object IPAddressToString -expandproperty  IPAddressToString
 
now, I wrote this and tested it using powershell v2 ctp3, and it should work on the Lower versions but have not tested it.
 
 
with that line, you will have just an IP address in the var, $rs. from there you can do other things and fancy stuff, all aglore.
 
 
the select statement cleans up the output of: [System.Net.Dns]::GetHostAddresses($i) otherwise the output is not really useable as the output is formated in its own colums, with outher propertys. the select-object strips everything out except the IP address.
 
 
-Nex6

Tuesday, February 03, 2009

Daemon, by Daniel Suarez

This book, Daemon, is really good. its a techo-thriller and if you like
cyber, and techo types of books this book is one for you.
 
-Nex6
View blog authority