Skip to content
KitploitKITPLOIT
FerramentasExploitsBlog
Log in
Enviar
FerramentasExploitsBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
PS2EXE — Módulo para compilar scripts do PowerShell em executáveis | Kitploit
Ferramentas/GitHubGitHub/mscholtes/ps2exe
Geração de PayloadsScripting e AutomaçãoUtilitários e Frameworks
GitHubmscholtes/ps2exe

PS2EXE

Módulo para compilar scripts do PowerShell em executáveis

Ver Repositório
1.8k24725há 3 mesesRevisado pelo Kitploit

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar

Repositório livre de IA - a inteligência artificial está matando a criatividade e a nossa natureza!

PS2EXE

Melhoria do ótimo script de Ingo Karstein com suporte a GUI. A saída e entrada GUI são ativadas com um único switch, gerando executáveis reais do Windows. Compila apenas scripts compatíveis com Powershell 5.x. Com interface gráfica opcional Win-PS2EXE.

Versão do módulo.

Você encontra a versão baseada em script aqui (https://github.com/MScholtes/TechNet-Gallery).

Autor: Markus Scholtes

Versão: 1.0.18

Data: 2026-06-06

Instalação

PS C:\> Install-Module ps2exe

ou baixe daqui: https://www.powershellgallery.com/packages/ps2exe/.

Uso

  Invoke-ps2exe .\source.ps1 .\target.exe

ou

  ps2exe .\source.ps1 .\target.exe

compila "source.ps1" no executável target.exe (se ".\target.exe" for omitido, a saída é escrita em ".\source.exe").

ou inicie o Win-PS2EXE para uma interface gráfica com

  Win-PS2EXE

Parâmetro

ps2exe [-inputFile] '<file_name>' [[-outputFile] '<file_name>']
       [-prepareDebug] [-x86|-x64] [-lcid <id>] [-STA|-MTA] [-noConsole] [-conHost] [-UNICODEEncoding]
       [-credentialGUI] [-iconFile '<filename>'] [-$embedFiles <hashtable>] [-title '<title>'] [-description '<description>']
       [-company '<company>'] [-product '<product>'] [-copyright '<copyright>'] [-trademark '<trademark>']
       [-version '<version>'] [-configFile] [-noOutput] [-noError] [-noVisualStyles] [-exitOnCancel]
       [-DPIAware] [-requireAdmin] [-supportOS] [-virtualize] [-longPaths]
      inputFile = Powershell script that you want to convert to executable (file has to be UTF8 or UTF16 encoded)
     outputFile = destination executable file name or folder, defaults to inputFile with extension '.exe'
   prepareDebug = create helpful information for debugging
     x86 or x64 = compile for 32-bit or 64-bit runtime only
           lcid = location ID for the compiled executable. Current user culture if not specified
     STA or MTA = 'Single Thread Apartment' or 'Multi Thread Apartment' mode
      noConsole = the resulting executable will be a Windows Forms app without a console window
        conHost = force start with conhost as console instead of Windows Terminal (disables redirections)
UNICODEEncoding = encode output as UNICODE in console mode
  credentialGUI = use GUI for prompting credentials in console mode
       iconFile = icon file name for the compiled executable
     embedFiles = files to embed given as hash, will be extracted to key of hash, source file names must be unique
                  (e.g. -embedFiles @{'Targetfilepath'='Sourcefilepath'} )
          title = title information (displayed in details tab of Windows Explorer's properties dialog)
    description = description information (not displayed, but embedded in executable)
        company = company information (not displayed, but embedded in executable)
        product = product information (displayed in details tab of Windows Explorer's properties dialog)
      copyright = copyright information (displayed in details tab of Windows Explorer's properties dialog)
      trademark = trademark information (displayed in details tab of Windows Explorer's properties dialog)
        version = version information (displayed in details tab of Windows Explorer's properties dialog)
     configFile = write config file (<outputfile>.exe.config)
       noOutput = the resulting executable will generate no standard output (includes verbose and information channel)
        noError = the resulting executable will generate no error output (includes warning and debug channel)
 noVisualStyles = disable visual styles for a generated windows GUI application (only with -noConsole)
   exitOnCancel = exits program when Cancel or "X" is selected in a Read-Host input box (only with -noConsole)
       DPIAware = if display scaling is activated, GUI controls will be scaled if possible (only with -noConsole)
   requireAdmin = if UAC is enabled, compiled executable run only in elevated context (UAC dialog appears if required)
      supportOS = use functions of newest Windows versions (execute [Environment]::OSVersion to see the difference)
     virtualize = application virtualization is activated (forcing x86 runtime)
      longPaths = enable long paths ( > 260 characters) if enabled on OS (works only with Windows 10)

Um executável gerado tem os seguintes parâmetros reservados:

-? [<MODIFIER>]     Powershell help text of the script inside the executable. The optional parameter combination
                    "-? -detailed", "-? -examples" or "-? -full" can be used to get the appropriate help text.
-debug              Forces the executable to be debugged. It calls "System.Diagnostics.Debugger.Launch()".
-extract:<FILENAME> Extracts the powerShell script inside the executable and saves it as FILENAME.
                    The script will not be executed.
-wait               At the end of the script execution it writes "Hit any key to exit..." and waits for a key to be pressed.
-end                All following options will be passed to the script inside the executable.
                    All preceding options are used by the executable itself and will not be passed to the script.

Observações

Uso do Powershell Core:

O PS2EXE pode ser usado com o Powershell Core. Para isso, basta instalar o módulo PS2EXE no Powershell Core conforme descrito acima. Mas como o .Net Core não vem com um compilador, o compilador do .Net Framework é usado (.Net Framework e Powershell 5.1 estão incluídos no Windows).

Por esse motivo, o PS2EXE só pode compilar scripts compatíveis com Powershell 5.1 e gera binários .Net 4.x, mas ainda pode ser usado diretamente em todos os sistemas Windows suportados sem dependências.

Incorporação de arquivos em executáveis compilados:

Com o parâmetro -embedFiles seguido por uma tabela hash com caminhos para arquivos, esses arquivos serão incorporados no executável compilado. Na inicialização do executável, esses arquivos serão gravados no disco nos caminhos especificados, ex.: -embedFiles @{'Targetfilepath1'='Sourcefilepath1';'Targetfilepath2'='Sourcefilepath2'}. Os nomes dos arquivos de origem devem ser únicos. Caminhos absolutos e relativos são permitidos. Para os caminhos de destino, um caminho relativo iniciado com '.\' é interpretado como relativo ao executável; sem o '.\' inicial, como relativo ao caminho atual em tempo de execução. As pastas são criadas automaticamente na inicialização, se necessário. No caminho de destino, variáveis de ambiente em notação cmd.exe como %TEMP% ou %APPDATA% são expandidas em tempo de execução. Uma falha ao criar um dos arquivos incorporados interromperá a execução do executável compilado imediatamente.

Lista de cmdlets não implementados:

Os comandos básicos de entrada/saída tiveram que ser reescritos em C# para o PS2EXE. Não implementados estão Write-Progress no modo console (muito trabalho) e Start-Transcript/Stop-Transcript (sem implementação de referência adequada pela Microsoft).

Formatação de saída no modo GUI:

Por padrão no PowerShell, as saídas de commandlets são formatadas linha por linha (como uma matriz de strings). Quando seu comando gera 10 linhas de saída e você usa saída GUI, 10 caixas de mensagem aparecerão, cada uma aguardando um OK. Para evitar isso, canalize seu comando para o comandlet Out-String. Isso converterá a saída em uma matriz de strings com 10 linhas; toda a saída será mostrada em uma única caixa de mensagem (por exemplo: dir C:\ | Out-String).

Baixar ferramenta