BIN2BAT

Iniciado por binary_death, Septiembre 01, 2013, 04:35:46 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

 
Código: php

@Echo Off
Title Bin2Bat
Set/P "File_Con=File: "
Set/P "File_Fin=BAT Name: "
Echo.
If Not Exist "%File_Con%" (
    Echo.File not Found.
    Pause>Nul
    Exit
)
Call:BfE "%File_Con%" "%File_Fin%"
Echo.Completed.
Pause>NUL
Exit
:BfE
  SetLocal EnableDelayedExpansion
Set "_=Echo."
   Set/A "$=%~z1+0xFF"
Call:D2H "%~z1" "#" & Call:D2H "%$%" "$"
    !_!@more +1 %%0^|Debug^>NUL^&Exit>"%~2"
   For /f "Eol=- Tokens=*" %%z in ('
       ^(!_!D 0100 %$%^&!_!Q^)^|DEBUG %~1
      ') do (Set "_TEX=%%z"
       Set "_SEX= !_TEX:~11,47!"
       Set "_SEX=!_SEX:   =!"
        call !_!e!_TEX:~5,4!%%_SEX:-= %%>>"%~2"
   )
(!_!RCX&!_!!#!&!_!N %~n2%~x1&!_!W&!_!Q)>>"%~2"
EndLocal & Exit/B
:D2H
  %ComSpec% /c Exit/B %~1
For /f "Tokens=* Delims=0" %%_ in (
     "%=ExitCode%") Do Set "%~2=%%_"
GoTo:EoF


Puede crear un fichero .bat que reconstruya cualquier binario de un máximo de 64 kb. Ah, sí, y tampoco funciona con archivos ejecutables de 32 bits (pero sí de 16, como archivos .com).