Land #9726, add simple Rex::Tar wrapper for consistency with other archive types

4.x
Brent Cook 2018-04-02 23:35:22 -05:00 committed by Jeffrey Martin
parent c2bf848ba9
commit 9d5ab1dedf
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
3 changed files with 12 additions and 4 deletions

View File

@ -48,8 +48,10 @@ require 'rex/text'
require 'rex/random_identifier'
# library for creating Powershell scripts for exploitation purposes
require 'rex/powershell'
# Library for processing and creating Zip compatbile archives
# Library for processing and creating Zip compatible archives
require 'rex/zip'
# Library for processing and creating tar compatible archives (not really a gem)
require 'rex/tar'
# Library for parsing offline Windows Registry files
require 'rex/registry'
# Library for parsing Java serialized streams

8
lib/rex/tar.rb Normal file
View File

@ -0,0 +1,8 @@
# -*- coding: binary -*-
require 'rubygems/package'
module Rex::Tar
class Reader < Gem::Package::TarReader; end
class Writer < Gem::Package::TarWriter; end
end

View File

@ -3,8 +3,6 @@
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'rubygems/package'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient
@ -41,7 +39,7 @@ class MetasploitModule < Msf::Auxiliary
destination = tarfile.split('.tar').first
FileUtils.mkdir_p(destination)
File.open(tarfile, 'rb') do |file|
Gem::Package::TarReader.new(file) do |tar|
Rex::Tar::Reader.new(file) do |tar|
tar.each do |entry|
dest = File.join destination, entry.full_name
if entry.file?