TheWover / donut

Generates x86, x64, or AMD64+x86 position-independent shellcode that loads .NET Assemblies, PE files, and other Windows payloads from memory and runs them with parameters
BSD 3-Clause "New" or "Revised" License
3.61k stars 638 forks source link

Error compiling donut msvc #117

Closed ahmedfamhy3 closed 1 year ago

ahmedfamhy3 commented 1 year ago

`C:\Users\Ahmed\Desktop\donut>nmake -f Makefile.msvc

Microsoft (R) Program Maintenance Utility Version 14.34.31937.0 Copyright (C) Microsoft Corporation. All rights reserved.

Could Not Find C:\Users\Ahmed\Desktop\donut\lib\donut.lib

Building exe2h
    cl /nologo loader\exe2h\exe2h.c loader\exe2h\mmap-windows.c

exe2h.c mmap-windows.c Generating Code...

Building loader
    cl -DBYPASS_AMSI_B -DBYPASS_WLDP_A -DBYPASS_ETW_B -Zp8 -c -nologo -Gy -Os -O1 -GR- -EHa -Oi -GS- -I include loader\loader.c hash.c encrypt.c loader\depack.c loader\clib.c

loader.c hash.c encrypt.c depack.c clib.c Generating Code... link -nologo -order:@loader\order.txt -entry:DonutLoader -fixed -subsystem:console -nodefaultlib loader.obj hash.obj encrypt.obj depack.obj clib.obj exe2h loader.exe [ Found valid DOS and NT header. [ Locating .text section. [ saved code to loader_exe_x86.h [ saved code to loader_exe_x86.go

Building generator
    rc include\donut.rc

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved.

    cl -Zp8 -nologo -DDONUT_EXE -I include donut.c hash.c encrypt.c format.c loader\clib.c lib\aplib64.lib include\donut.res

donut.c hash.c encrypt.c format.c clib.c Generating Code... donut.obj : error LNK2019: unresolved external symbol _aP_pack referenced in function _compress_file donut.obj : error LNK2019: unresolved external symbol _aP_workmem_size referenced in function _compress_file donut.obj : error LNK2019: unresolved external symbol _aP_max_packed_size referenced in function _compress_file lib\aplib64.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86' donut.exe : fatal error LNK1120: 3 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.EXE"' : return code '0x2' Stop.`

TheWover commented 1 year ago

This is because you are using the x86 Native Tools Command Prompt for Visual Studio instead of the x64 Native Tools Command Prompt for Visual Studio. The makefile is configured for 64-bit by default. To compile for 32-bit, do a find-and-replace in the makefile for "64" -> "32".