Sha256: d36e5288a5d9259281585b2e2b44c201bb8569dfd6019875c150e8a2e2322649

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
require 'open3'
require 'pathname'

GM_DIR = "#{__dir__}/../helpers/gadgetmarshaller"

if ARGV.size < 3
  abort "Usage: gadgetmarshal /path/to/ysoserial.jar Gadget1 cmd (optional)/path/to/output/file"
end

ARGV[0] = Pathname.new(ARGV[0]).realpath.to_s

Dir.chdir(GM_DIR) do
  Open3.capture3("javac GadgetMarshaller.java") unless %w[GadgetMarshaller.class GadgetMarshaller$MarshalOutputStream.class].all?(File.method(:exist?))
  out, err, _ = Open3.capture3("java", "GadgetMarshaller", *ARGV[0..3], :binmode => true)
  # $stderr.write err
  $stdout.binmode
  $stdout.write out
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ermir-0.1.2 bin/gadgetmarshal