-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathConvertTo-ROT13.ps1
48 lines (42 loc) · 1.29 KB
/
ConvertTo-ROT13.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function ConvertTo-ROT13
{
<#
.SYNOPSIS
Nishang script which can encode a string to ROT13 or decode a ROT13 string.
.DESCRIPTION
Nishang script which can encode a string to ROT13 or decode a ROT13 string.
.PARAMETER rot13string
The string which needs to be encoded or decode.
.EXAMPLE
PS > ConvertTo-ROT13 -rot13string supersecret
Use above command to encode a string.
.EXAMPLE
PS > ConvertTo-ROT13 -rot13string fhcrefrperg
Use above command to decode a string.
.LINK
http://learningpcs.blogspot.com/2012/06/powershell-v2-function-convertfrom.html
http://www.labofapenetrationtester.com/2016/11/exfiltration-of-user-credentials-using-wlan-ssid.html
https://github.com/samratashok/nishang
#>
[CmdletBinding()] param(
[Parameter(Mandatory = $False)]
[String]
$rot13string
)
[String] $string = $null;
$rot13string.ToCharArray() | ForEach-Object {
if((([int] $_ -ge 97) -and ([int] $_ -le 109)) -or (([int] $_ -ge 65) -and ([int] $_ -le 77)))
{
$string += [char] ([int] $_ + 13);
}
elseif((([int] $_ -ge 110) -and ([int] $_ -le 122)) -or (([int] $_ -ge 78) -and ([int] $_ -le 90)))
{
$string += [char] ([int] $_ - 13);
}
else
{
$string += $_
}
}
$string
}