Minggu, 13 Februari 2011

Powershell - Base64 Functions

Since I am slowly building up a Powershell Pen Testing suite, I wanted to grab a few fuzzing functions. The Base64 functions outlined here:
http://www.techmumbojumblog.com/?p=306
have been helpful for input and URL analysis. To save myself the trouble of reinventing this from time to time I am adding it to the $profile.AllUsersAllHosts profile on my machine to allow me to call the code I need in a jiffy. I am even aliasing them to make life easier. Here are the functions:
# http://www.techmumbojumblog.com/?p=306

function ConvertTo-Base64($string) {
$bytes = [System.Text.Encoding]::UTF8.GetBytes($string);
$encoded = [System.Convert]::ToBase64String($bytes);

return $encoded;
}

function ConvertFrom-Base64($string) {
$bytes = [System.Convert]::FromBase64String($string);
$decoded = [System.Text.Encoding]::UTF8.GetString($bytes);

return $decoded;
}
and the aliases:

# Add aliases for Coversion functions

New-Alias -Name ct64 -Value ConvertTo-Base64 -Description "ConvertTo-Base64 alias" -Option AllScope
New-Alias -Name cf64 -Value ConvertFrom-Base64 -Description "ConvertFrom-Base64 alias" -Option AllScope

0 komentar:

Posting Komentar

 
Powered by Blogger