Skip to content

Commit

Permalink
Make it possible to specify a base when rebuilding the PE
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Oct 11, 2023
1 parent 930a999 commit 7ba60f0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions malduck/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ def main(log_level, verbose):
@main.command("fixpe")
@click.argument("mempath", type=click.Path(exists=True))
@click.argument("outpath", type=click.Path(), required=False)
@click.option(
"--base",
"-b",
default=None,
help="Set imagebase of the result",
)
@click.option(
"--force/--no-force",
"-f",
default=False,
help="Try to fix dump even if it's correctly parsed as PE",
)
def fixpe(mempath, outpath, force):
def fixpe(mempath, outpath, force, base):
"""Fix dumped PE file into the correct form"""
with ProcessMemoryPE.from_file(mempath) as p:
base = 0 if base is None else int(base, 0)
with ProcessMemoryPE.from_file(mempath, base=base) as p:
if not force and p.is_image_loaded_as_memdump():
click.echo(
"Input file looks like correct PE file. Use -f if you want to fix it anyway."
Expand Down

0 comments on commit 7ba60f0

Please sign in to comment.