Skip to content

Commit

Permalink
Save resource path handling (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
nazywam authored Apr 24, 2022
1 parent f00fe7a commit b8fb82d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions malduck/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b8fb82d

Please sign in to comment.