diff --git a/modules/generators/compression/zip/secgen_local/local.rb b/modules/generators/compression/zip/secgen_local/local.rb index 08c933f0b..b12416166 100644 --- a/modules/generators/compression/zip/secgen_local/local.rb +++ b/modules/generators/compression/zip/secgen_local/local.rb @@ -33,9 +33,9 @@ class ZipGenerator < StringEncoder zip_file.get_output_stream(self.file_name) { |os| os.write data } - file_contents = File.binread(zip_file_path) - FileUtils.rm(zip_file_path) end + file_contents = File.binread(zip_file_path) + FileUtils.rm(zip_file_path) end self.outputs << Base64.strict_encode64(file_contents) end @@ -65,4 +65,4 @@ class ZipGenerator < StringEncoder end end -ZipGenerator.new.run \ No newline at end of file +ZipGenerator.new.run diff --git a/modules/generators/image/random_jpg/secgen_local/local.rb b/modules/generators/image/random_jpg/secgen_local/local.rb index 136b4914f..04d80a02d 100644 --- a/modules/generators/image/random_jpg/secgen_local/local.rb +++ b/modules/generators/image/random_jpg/secgen_local/local.rb @@ -1,6 +1,7 @@ #!/usr/bin/ruby require 'base64' require 'rmagick' +require 'fileutils' require_relative '../../../../../lib/objects/local_string_encoder.rb' class ImageGenerator < StringEncoder attr_accessor :selected_image_path @@ -23,6 +24,7 @@ class ImageGenerator < StringEncoder image.write(tmp_file_path) self.outputs << Base64.strict_encode64(File.binread(tmp_file_path)) + FileUtils.rm(tmp_file_path) end def encoding_print_string @@ -30,4 +32,4 @@ class ImageGenerator < StringEncoder end end -ImageGenerator.new.run \ No newline at end of file +ImageGenerator.new.run