diff --git a/malduck/main.py b/malduck/main.py index 7ce5c1c..61e4b8d 100644 --- a/malduck/main.py +++ b/malduck/main.py @@ -150,9 +150,8 @@ def extract_resources(filepath, outpath): res_data = pe.pe.get_data(e3.data.struct.OffsetToData, e3.data.struct.Size) out_name = f"{e1_name}-{e2_name}" - click.echo(f"Found resource {out_name} ({len(res_data)} bytes)") - # make sure there's no funny business - Path(out_dir).joinpath(out_dir / out_name).resolve().relative_to( - out_dir.resolve() - ).write_bytes(res_data) + out_path = out_dir / (Path(out_name).name) + click.echo(f"Saving resource {out_name} ({len(res_data)} bytes) to {out_path}") + + out_path.write_bytes(res_data)