Skip to content

Commit

Permalink
Windows - support DLLs
Browse files Browse the repository at this point in the history
  • Loading branch information
robwaz committed Mar 21, 2024
1 parent fd252d2 commit dd693c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pwnshop/challenges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ class WindowsChallenge(Challenge):
CFG = True
DYNAMIC_BASE = True
ASLR_HIGH_ENTROPY = True
MAKE_DLL = False

def build_compiler_cmd(self):
cmd = [self.COMPILER]
Expand All @@ -349,6 +350,9 @@ def build_compiler_cmd(self):
else:
cmd.append("/guard:cf-")

if self.MAKE_DLL:
cmd.append("/LD")

return cmd
# Linker options
cmd.append('/LINK')
Expand All @@ -374,7 +378,11 @@ def build_binary(self, source=None):
if self.build_image is None:
with tempfile.TemporaryDirectory(prefix='pwnshop-') as workdir:
src_path = f"{workdir}/{self.__class__.__name__.lower()}.c"
bin_path = f"{workdir}/{self.__class__.__name__.lower()}.exe"

if self.MAKE_DLL:
bin_path = f"{workdir}/{self.__class__.__name__.lower()}.dll"
else:
bin_path = f"{workdir}/{self.__class__.__name__.lower()}.exe"
pdb_path = f"{workdir}/{self.__class__.__name__.lower()}.pdb"
with open(src_path, 'w') as f:
f.write(source)
Expand Down

0 comments on commit dd693c7

Please sign in to comment.