2017-03-21 09:38:18 +00:00
|
|
|
#!/usr/bin/env ruby
|
2018-04-02 04:26:42 +00:00
|
|
|
|
2017-03-21 09:38:18 +00:00
|
|
|
#
|
|
|
|
# This script generates Mettle payload wrappers
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'erb'
|
|
|
|
|
|
|
|
schemes = [
|
|
|
|
'tcp',
|
|
|
|
'http',
|
|
|
|
'https'
|
|
|
|
]
|
|
|
|
|
|
|
|
arches = [
|
2017-10-30 19:04:10 +00:00
|
|
|
['aarch64', 'Linux', 'aarch64-linux-musl'],
|
|
|
|
['armbe', 'Linux', 'armv5b-linux-musleabi'],
|
|
|
|
['armle', 'Linux', 'armv5l-linux-musleabi'],
|
|
|
|
['mips64', 'Linux', 'mips64-linux-muslsf'],
|
|
|
|
['mipsbe', 'Linux', 'mips-linux-muslsf'],
|
|
|
|
['mipsle', 'Linux', 'mipsel-linux-muslsf'],
|
|
|
|
['ppc', 'Linux', 'powerpc-linux-muslsf'],
|
|
|
|
['ppce500v2', 'Linux', 'powerpc-e500v2-linux-musl'],
|
|
|
|
['ppc64le', 'Linux', 'powerpc64le-linux-musl'],
|
|
|
|
['x64', 'Linux', 'x86_64-linux-musl'],
|
|
|
|
['x86', 'Linux', 'i486-linux-musl'],
|
|
|
|
['zarch', 'Linux', 's390x-linux-musl'],
|
|
|
|
['x64', 'OSX', 'x86_64-apple-darwin'],
|
2017-12-12 08:05:23 +00:00
|
|
|
['aarch64', 'Apple_iOS', 'aarch64-iphone-darwin'],
|
2017-03-21 09:38:18 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
arch = ''
|
|
|
|
payload = ''
|
2017-07-18 18:13:38 +00:00
|
|
|
platform = ''
|
2017-03-21 09:38:18 +00:00
|
|
|
scheme = ''
|
|
|
|
cwd = File::dirname(__FILE__)
|
|
|
|
|
2017-07-18 18:13:38 +00:00
|
|
|
arches.each do |a, pl, pa|
|
2017-03-21 09:38:18 +00:00
|
|
|
schemes.each do |s|
|
|
|
|
arch = a
|
2017-07-18 18:13:38 +00:00
|
|
|
platform = pl
|
|
|
|
payload = pa
|
2017-03-21 09:38:18 +00:00
|
|
|
scheme = s
|
2017-07-18 18:13:38 +00:00
|
|
|
|
|
|
|
template = File::read(File::join(cwd, "meterpreter_reverse.erb"))
|
|
|
|
renderer = ERB.new(template)
|
2017-12-12 08:05:23 +00:00
|
|
|
filename = File::join('modules', 'payloads', 'singles', platform.downcase, arch, "meterpreter_reverse_#{scheme}.rb")
|
2017-03-21 09:38:18 +00:00
|
|
|
File::write(filename, renderer.result())
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
`bundle exec #{File::join(cwd, 'update_payload_cached_sizes.rb')}`
|