Sha256: 6dfac711c0840bb7a676407f0a895fdc3f5f0e7d8707a3bd170495cf4133e821
Contents?: true
Size: 1 KB
Versions: 8
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module MooTool module Controllers # Controller for extracting or viewing a KernelCollection (.kc file) class KernelCollection < ControllerBase command 'kc' description 'Kernel Collections' def extract(command, output_folder) file = MachO.open command.file input = File.open(command.file, 'rb') file.command(:LC_FILESET_ENTRY).each do |entry| output_path = File.join(output_folder, entry.entry_id.to_s) puts "Writing to #{output_path}" output_file = File.open(output_path, 'wb') # rubocop:disable Naming/VariableNumber # We do not have control of this name as it is part of ruby-macho matching = file.command(:LC_SEGMENT_64).find { |c| c.fileoff == entry.fileoff } # rubocop:enable Naming/VariableNumber input.seek(matching.fileoff) output_file.write input.read(matching.filesize) output_file.close end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems