Fix /DEF option (partially)

This commit is contained in:
d3adc0de 2022-06-14 16:26:43 +01:00
parent a07bf92cc7
commit 8fffbe731d

@ -142,9 +142,6 @@ class NativeArtifactGenerator(Generator):
modules=[]
)
self.dll_payload = None
self.dll_compiler_args = self.compiler.default_dll_args(self.outfiles["dll-temp"])
if self.exports and os.path.isfile(self.exports):
self.dll_compiler_args["/DEF"] = f'"{os.path.abspath(self.exports)}"'
def compile_dll(self, shellcode=None):
if not shellcode:
@ -152,6 +149,8 @@ class NativeArtifactGenerator(Generator):
self.dll_writer.write_source(shellcode=shellcode)
self.compiler.aargs = ""
self.compiler.default_dll_args(outfile=self.outfiles["dll-temp"])
if self.exports and os.path.isfile(self.exports):
self.compiler.args["/DEF"] = f'"{Path(self.exports).absolute()}"'
self.compiler.compile([self.dll_writer.outfile])
if not os.path.isfile(self.outfiles["dll-temp"]):
raise FileNotFoundError("Error generating DLL")