Skip to content

How to compile CrackMapExec for Windows

Thomas D edited this page Jul 12, 2022 · 22 revisions

1. Set up the compilation environment

2. Monkey-Patch the original code

General rules to ensure Windows compatibility:

  1. Remove references to Unix stuff like os.geteuid(), that don't make sense on Windows
  2. Patch the code section related to term colors from
from termcolor import cprint, colored

to

from termcolor import cprint, colored
import colorama
colorama.init()

Take a look at the following link for more information on that topic.

  1. Remove illegal chars in created/accessed filenames

3. Compile

pyinstaller --clean --onefile crackmapexec.py

4. Profit

Find the around-6MB executable in the created dist folder