Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Bat2Bin

A utility that creates a standalone executable (.exe) by embedding a Batch file (or any payload) into the .rsrc section (RC_DATA) of the binary.

Upon execution, the generated EXE extracts the embedded file to the system's temporary directory, executes it via CMD, and performs a cleanup by deleting the file immediately after execution.


Features

  • Resource Embedding: Injects files into the PE (Portable Executable) resource section.
  • Execution: Extracts and runs scripts from the %TEMP% directory.
  • Auto-Cleanup: Automatically deletes the extracted file after the process terminates.
  • Universal Loader: Technically supports embedding any file type, not just Batch scripts.
  • Standalone: The resulting EXE requires no external dependencies to run the payload.

How it Works

  1. Input: You provide a Batch file or script.
  2. Compilation: The tool creates a stub and embeds your file as an RC_DATA resource.
  3. Extraction: When the output EXE is launched, it calls FindResource, LoadResource, and LockResource to locate the data.
  4. Deployment: It writes the bytes to a random filename in the Temp folder.
  5. Execution: It starts a new process (cmd.exe) to run the file.
  6. Cleanup: Once the process exits, the EXE cleans the temporary file from the disk.

Preview

Application Screenshot


Disclaimer

This tool is intended for educational purposes only. The author is not responsible for any misuse or damage caused by this program. Always ensure you have permission before executing scripts on a target system.


Connect with Me

If you have questions, suggestions, or want to join the community:


Developed with no ❤️ by PySharp

About

a program that packs a batch script to a exe

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages