Last active
October 26, 2022 11:32
-
-
Save gabemarshall/9738287489332716d60b3bb09ea68250 to your computer and use it in GitHub Desktop.
makeiso helper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python ~/makeiso.py payload.exe | |
try: | |
from cStringIO import StringIO as BytesIO | |
except ImportError: | |
from io import BytesIO | |
import pycdlib | |
import sys | |
args = sys.argv[1:] | |
iso = pycdlib.PyCdlib() | |
iso.new(interchange_level=4) | |
targetfilenameFirst = args[0] | |
targetfilename = '{}'.format(targetfilenameFirst) | |
targetfilehandle = open(targetfilename, 'rb') | |
targetfilebody = targetfilehandle.read() | |
iso.add_fp(BytesIO(targetfilebody), len(targetfilebody), '/' + targetfilename + ';1') | |
iso.write('{}.iso'.format(targetfilenameFirst)) | |
iso.close() | |
targetfilehandle.close() | |
print('{}.iso has been created!'.format(targetfilenameFirst)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment