2014-09-08 20:32:13 +00:00
|
|
|
# -*- coding: binary -*-
|
2006-09-01 15:50:10 +00:00
|
|
|
=begin
|
|
|
|
|
|
|
|
The Metasploit Rex library is provided under the 3-clause BSD license.
|
|
|
|
|
2014-09-08 20:32:13 +00:00
|
|
|
Copyright (c) 2005-2014, Rapid7, Inc.
|
2006-09-01 15:50:10 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
2014-03-13 14:46:20 +00:00
|
|
|
* Neither the name of Rapid7, Inc. nor the names of its contributors may be
|
2006-09-01 15:50:10 +00:00
|
|
|
used to endorse or promote products derived from this software without
|
|
|
|
specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2005-06-03 04:51:51 +00:00
|
|
|
module Rex
|
2013-08-30 21:28:33 +00:00
|
|
|
Root = File.join(File.expand_path(File.dirname(__FILE__)), 'rex')
|
|
|
|
LogSource = "rex"
|
2005-06-03 04:51:51 +00:00
|
|
|
end
|
|
|
|
|
2016-07-05 15:33:45 +00:00
|
|
|
#
|
|
|
|
# REX Gems
|
|
|
|
#
|
2016-09-14 17:07:26 +00:00
|
|
|
|
2016-07-05 15:33:45 +00:00
|
|
|
# Text manipulation library for things like generating random string
|
|
|
|
require 'rex/text'
|
|
|
|
# Library for Generating Randomized strings valid as Identifiers such as variable names
|
|
|
|
require 'rex/random_identifier'
|
|
|
|
# library for creating Powershell scripts for exploitation purposes
|
|
|
|
require 'rex/powershell'
|
2018-03-19 23:59:39 +00:00
|
|
|
# Library for processing and creating Zip compatible archives
|
2016-07-05 15:33:45 +00:00
|
|
|
require 'rex/zip'
|
2018-03-19 23:59:39 +00:00
|
|
|
# Library for processing and creating tar compatible archives (not really a gem)
|
|
|
|
require 'rex/tar'
|
2016-07-05 15:33:45 +00:00
|
|
|
# Library for parsing offline Windows Registry files
|
|
|
|
require 'rex/registry'
|
|
|
|
# Library for parsing Java serialized streams
|
|
|
|
require 'rex/java'
|
2016-07-15 21:01:21 +00:00
|
|
|
# Library for creating C-style Structs
|
|
|
|
require 'rex/struct2'
|
2016-07-21 23:07:23 +00:00
|
|
|
# Library for working with OLE
|
|
|
|
require 'rex/ole'
|
2016-09-01 16:38:07 +00:00
|
|
|
# Library for creating and/or parsing MIME messages
|
|
|
|
require 'rex/mime'
|
2016-09-14 17:07:26 +00:00
|
|
|
# Library for polymorphic encoders
|
|
|
|
require 'rex/encoder'
|
|
|
|
# Architecture subsystem
|
|
|
|
require 'rex/arch'
|
2016-10-11 22:35:44 +00:00
|
|
|
# Exploit Helper Library
|
|
|
|
require 'rex/exploitation'
|
2016-07-05 15:33:45 +00:00
|
|
|
|
2005-06-04 08:23:16 +00:00
|
|
|
# Generic classes
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/exceptions'
|
2011-05-12 20:03:55 +00:00
|
|
|
require 'rex/transformer'
|
2016-06-21 18:56:36 +00:00
|
|
|
require 'rex/random_identifier'
|
2011-05-12 20:03:55 +00:00
|
|
|
require 'rex/time'
|
|
|
|
require 'rex/job_container'
|
|
|
|
require 'rex/file'
|
2005-07-17 00:52:47 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Thread safety and synchronization
|
|
|
|
require 'rex/sync'
|
2005-07-10 20:49:13 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Thread factory
|
|
|
|
require 'rex/thread_factory'
|
2005-06-04 08:23:16 +00:00
|
|
|
|
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Assembly
|
|
|
|
require 'rex/assembly/nasm'
|
2005-06-03 04:51:51 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Logging
|
|
|
|
require 'rex/logging/log_dispatcher'
|
2005-06-04 08:23:16 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# IO
|
|
|
|
require 'rex/io/stream'
|
|
|
|
require 'rex/io/stream_abstraction'
|
|
|
|
require 'rex/io/stream_server'
|
2005-12-13 06:08:40 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Sockets
|
|
|
|
require 'rex/socket'
|
2005-12-13 06:08:40 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Protocols
|
|
|
|
require 'rex/proto'
|
2012-07-09 22:39:26 +00:00
|
|
|
require 'rex/mac_oui'
|
2006-07-27 00:59:00 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Parsers
|
|
|
|
require 'rex/parser/arguments'
|
|
|
|
require 'rex/parser/ini'
|
2006-07-27 00:59:00 +00:00
|
|
|
|
2011-05-11 23:28:12 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
# Compatibility
|
|
|
|
require 'rex/compat'
|
2011-05-11 23:28:12 +00:00
|
|
|
|
2013-02-20 21:33:24 +00:00
|
|
|
# SSLScan
|
2013-02-11 23:08:14 +00:00
|
|
|
require 'rex/sslscan/scanner'
|
|
|
|
require 'rex/sslscan/result'
|
|
|
|
|
2018-04-18 01:12:26 +00:00
|
|
|
# Cryptography
|
|
|
|
require 'rex/crypto/aes256'
|
|
|
|
require 'rex/crypto/rc4'
|
|
|
|
|
2006-12-02 19:48:10 +00:00
|
|
|
|
2005-09-16 03:29:11 +00:00
|
|
|
# Overload the Kernel.sleep() function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
2013-08-30 21:28:33 +00:00
|
|
|
def sleep(seconds=nil)
|
|
|
|
Rex::ThreadSafe.sleep(seconds)
|
|
|
|
end
|
2005-09-16 03:29:11 +00:00
|
|
|
")
|
|
|
|
|
2005-09-27 05:31:48 +00:00
|
|
|
# Overload the Kernel.select function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
2013-08-30 21:28:33 +00:00
|
|
|
def select(rfd = nil, wfd = nil, efd = nil, to = nil)
|
|
|
|
Rex::ThreadSafe.select(rfd, wfd, efd, to)
|
|
|
|
end
|
2008-11-16 21:10:35 +00:00
|
|
|
")
|