Skip to content

Instantly share code, notes, and snippets.

@ihaveamac
Created August 24, 2016 18:05
Show Gist options
  • Save ihaveamac/e5e143e7e24656d3f681778e1f255904 to your computer and use it in GitHub Desktop.
Save ihaveamac/e5e143e7e24656d3f681778e1f255904 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import os
if len(sys.argv) != 2:
sys.exit("padfirm.py firm.bin")
filenamesplit = os.path.splitext(sys.argv[1])
filename = os.path.basename(filenamesplit[0])
fileext = filenamesplit[1]
with open("%s_padded%s" % (filename, fileext), "wb") as f:
with open(sys.argv[1], "rb") as o:
f.write(o.read().ljust(0x400000, b"\x00"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment