Thanks to visit codestin.com
Credit goes to superwidgets.wordpress.com

Posts tagged “decode-String

Decode-String function added to AZSBTools PowerShell module


Decode-String is a function that helps to decode hexadecimal codes often used in URLs and seen in Web server logs. For example %26 would be replaced by &.

Example:

Decode-String -EncodedString '%3CSCRIPT%3Evar+x+%3D+String(%2FXSS%2F)%3Bx+%3D+x.substring(1%2C+x.length-1)%3Balert(x)%3C%2FSCRIPT%3E'
Decode-String Example

The function replaces ‘+’ signs with spaces as in Java Script. Using the -KeepPlus switch reverses this behavior keeping the ‘+’ signs:

Decode-String Example with the -KeepPlus switch

To use/update the AZSBTools PowerShell module which is available in the PowerShell Gallery, you can use the following code:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# PowerShellGallery dropped Ssl3 and Tls as of 1 April 2020
Remove-Module AZSBTools -Force -EA 0
Install-Module AZSBTools -Force -AllowClobber -SkipPublisherCheck # -Scope CurrentUser
Import-Module AZSBTools -DisableNameChecking -Force
Get-Command -Module AZSBTools

You need PowerShell 5. To view your PowerShell version, in an elevated PowerShell ISE window type

$PSVersionTable
This image has an empty alt attribute; its file name is sb-tools001.jpg

To download and install the latest version of AZSBTools from the PowerShell Gallery and its dependencies, type

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

To trust the Microsoft PowerShell Gallery repository, then

Install-Module AZSBTools,Az -Force -AllowClobber -Scope CurrentUser

AZSBTools contains functions that depend on Az module, and they’re typically installed together.

To load the AZSBTools, and Az modules type:

Import-Module AZSBTools,Az -DisableNameChecking

To view a list of cmdlets/functions in AZSBTools, type

Get-Command -Module AZSBTools

To view the built-in help of one of the AZSBTools functions/cmdlets, type

help <function/cmdlet name> -show

such as

help Get-DayOfMonth -show
This image has an empty alt attribute; its file name is get-dayofmonth07.jpg




Design a site like this with WordPress.com
Get started