Skip to content

Latest commit

 

History

History
122 lines (92 loc) · 3.34 KB

PowerShell-2-Batch.md

File metadata and controls

122 lines (92 loc) · 3.34 KB

Logo

Table of Contents
  1. Description
  2. The Function
  3. Examples
  4. Contact
  5. Acknowledgments

PowerShell-2-Batch

Python
YouTube Tutorial

Description

This function will convert a PowerShell script to a Batch file

The Function

[PowerShell-2-Batch]

Using this function will convert your powershell payload over to Base64 and then change the extension on it to be a .BAT file Make the conversion with this function using the following syntax:

P2B -Path "C:\Users\User\Desktop\example.ps1"

or

"C:\Users\User\Desktop\example.ps1" | P2B
function P2B {
    param
    (
        [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [string]
        $Path
    )
 
    process
    {
        $encoded = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes((Get-Content -Path $Path -Raw -Encoding UTF8)))
        $newPath = [Io.Path]::ChangeExtension($Path, ".bat")
        "@echo off`npowershell -w h -NoP -NonI -Exec Bypass -enc $encoded" | Set-Content -Path $newPath -Encoding Ascii
    }
}

(back to top)

Examples

Listed below are payloads that have used one of these functions:

No payloads have made use of this function yet, please feel free to contact me to get your payload featured here if you do use it

(back to top)

Contact

📱 My Socials 📱

C#
YouTube
Python
Twitter
Golang
Instagram
Jsonnet
Discord

(back to top)

Acknowledgments


HOME-PAGE

(back to top)