69 lines
2.2 KiB
PowerShell
69 lines
2.2 KiB
PowerShell
function init_pseudo {
|
|
$Script:pseudotbl = @()
|
|
$Script:realtbl = @("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
|
|
do {
|
|
$tmp = get-random -Minimum 0 -Maximum 256
|
|
if (!($Script:pseudotbl.contains($tmp))) {
|
|
$Script:pseudotbl += $tmp
|
|
}
|
|
} while ($null -eq $Script:pseudotbl[23])
|
|
}
|
|
init_pseudo
|
|
|
|
function pseudo {
|
|
param($realinput)
|
|
if ($realinput -is [String]) {
|
|
[String]$tmp = $realinput.toLower()
|
|
for($i=0;$i -lt $tmp.length;$i++){
|
|
if($tmp[$i] -match "[a-z]"){
|
|
for($c=0;$c -lt 23;$c++){
|
|
if($tmp[$i] -eq $Script:realtbl[$c]){
|
|
$pseudooutput += [char]$Script:pseudotbl[$c]
|
|
$c = 23
|
|
}
|
|
}
|
|
}else {
|
|
$pseudooutput += $tmp[$i]
|
|
}
|
|
}
|
|
}elseif ($realinput -is [Object[]]) {
|
|
$pseudooutput = @()
|
|
foreach($item in $realinput){
|
|
$partoutput=""
|
|
if($item -is [String]){
|
|
[String]$tmp = $item.toLower()
|
|
for($i=0;$i -lt $tmp.length;$i++){
|
|
if($tmp[$i] -match "[a-z]"){
|
|
for($c=0;$c -lt 23;$c++){
|
|
if($tmp[$i] -eq $Script:realtbl[$c]){
|
|
$partoutput += [char]$Script:pseudotbl[$c]
|
|
$c = 23
|
|
}
|
|
}
|
|
}else{
|
|
$partoutput += $tmp[$i]
|
|
}
|
|
}
|
|
$pseudooutput += $partoutput
|
|
}else{
|
|
$pseudooutput += $item
|
|
}
|
|
}
|
|
}else{
|
|
$pseudooutput = $realinput
|
|
}
|
|
return $pseudooutput
|
|
}
|
|
|
|
|
|
function Log {
|
|
param ($loginput,[switch]$clear)
|
|
if($clear){
|
|
#Add-Content -Path .\Log.txt -Value "[$(Get-Date)] $loginput"
|
|
$Script:logvar += "[$(Get-Date)] $loginput `r`n"
|
|
}else{
|
|
$Script:logvar += "[$(Get-Date)] " + (pseudo $loginput) + "`r`n"
|
|
#$logcontent = "[$(Get-Date)] " + (pseudo $loginput)
|
|
#Add-Content -Path .\Log.txt -Value $logcontent
|
|
}
|
|
} |