-
Notifications
You must be signed in to change notification settings - Fork 65
/
Base64TypeData.ps1
23 lines (17 loc) · 1.24 KB
/
Base64TypeData.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Inline B64CMD Converter (Add to PoSh Profile)
## via System.String Type Custom ScriptProperty Member
# Base64 Encode/Decode
Update-TypeData -TypeName System.String -MemberName "ToB64" -MemberType scriptproperty -Value {[System.Convert]::ToBase64String([System.Text.Encoding]::UNICODE.GetBytes($this))}
Update-TypeData -TypeName System.String -MemberName "FromB64" -MemberType scriptproperty -Value {[System.Text.Encoding]::UNICODE.GetString([System.Convert]::FromBase64String($this))}
# Add iex
Update-TypeData -TypeName System.String -MemberName "AddIEX" -MemberType scriptproperty -Value {"iex (`"$this`")"}
# Add exe
Update-TypeData -TypeName System.String -MemberName "AddEXE" -MemberType scriptproperty -Value {"powershell.exe -enc $this"}
# Run
Update-TypeData -TypeName System.String -MemberName "Run" -MemberType ScriptProperty -Value {powershell.exe -enc $this}
#ToClipBoard
Update-TypeData -TypeName System.String -MemberName "ToClip" -MemberType scriptproperty -Value {$this | Set-Clipboard}
#ToFile
Update-TypeData -TypeName System.String -MemberName "ToFile" -MemberType ScriptProperty -Value {New-Item -Path $pwd -Name Payload.txt -ItemType File -Value $this -Force}
## To remove:
## Remove-TypeData -TypeName System.String