2014-09-08 22:32:13 +02:00
|
|
|
# -*- coding: binary -*-
|
2006-09-01 17:50:10 +02:00
|
|
|
=begin
|
|
|
|
|
|
|
|
The Metasploit Rex library is provided under the 3-clause BSD license.
|
|
|
|
|
2014-09-08 22:32:13 +02:00
|
|
|
Copyright (c) 2005-2014, Rapid7, Inc.
|
2006-09-01 17:50:10 +02: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 15:46:20 +01:00
|
|
|
* Neither the name of Rapid7, Inc. nor the names of its contributors may be
|
2006-09-01 17:50:10 +02: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 06:51:51 +02:00
|
|
|
module Rex
|
2013-08-30 23:28:33 +02:00
|
|
|
Root = File.join(File.expand_path(File.dirname(__FILE__)), 'rex')
|
|
|
|
LogSource = "rex"
|
2005-06-03 06:51:51 +02:00
|
|
|
end
|
|
|
|
|
2016-07-05 17:33:45 +02:00
|
|
|
#
|
|
|
|
# REX Gems
|
|
|
|
#
|
2016-09-14 19:07:26 +02:00
|
|
|
|
2016-07-05 17:33:45 +02: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'
|
|
|
|
# Library for processing and creating Zip compatbile archives
|
|
|
|
require 'rex/zip'
|
|
|
|
# Library for parsing offline Windows Registry files
|
|
|
|
require 'rex/registry'
|
|
|
|
# Library for parsing Java serialized streams
|
|
|
|
require 'rex/java'
|
2016-07-15 23:01:21 +02:00
|
|
|
# Library for creating C-style Structs
|
|
|
|
require 'rex/struct2'
|
2016-07-22 01:07:23 +02:00
|
|
|
# Library for working with OLE
|
|
|
|
require 'rex/ole'
|
2016-09-01 18:38:07 +02:00
|
|
|
# Library for creating and/or parsing MIME messages
|
|
|
|
require 'rex/mime'
|
2016-09-14 19:07:26 +02:00
|
|
|
# Library for polymorphic encoders
|
|
|
|
require 'rex/encoder'
|
|
|
|
# Architecture subsystem
|
|
|
|
require 'rex/arch'
|
2016-10-12 00:35:44 +02:00
|
|
|
# Exploit Helper Library
|
|
|
|
require 'rex/exploitation'
|
2016-07-05 17:33:45 +02:00
|
|
|
|
2005-06-04 10:23:16 +02:00
|
|
|
# Generic classes
|
2005-07-09 23:18:49 +02:00
|
|
|
require 'rex/exceptions'
|
2011-05-12 22:03:55 +02:00
|
|
|
require 'rex/transformer'
|
2016-06-21 20:56:36 +02:00
|
|
|
require 'rex/random_identifier'
|
2011-05-12 22:03:55 +02:00
|
|
|
require 'rex/time'
|
|
|
|
require 'rex/job_container'
|
|
|
|
require 'rex/file'
|
2005-07-17 02:52:47 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Thread safety and synchronization
|
|
|
|
require 'rex/sync'
|
2005-07-10 22:49:13 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Thread factory
|
|
|
|
require 'rex/thread_factory'
|
2005-06-04 10:23:16 +02:00
|
|
|
|
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Assembly
|
|
|
|
require 'rex/assembly/nasm'
|
2005-06-03 06:51:51 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Logging
|
|
|
|
require 'rex/logging/log_dispatcher'
|
2005-06-04 10:23:16 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# IO
|
|
|
|
require 'rex/io/stream'
|
|
|
|
require 'rex/io/stream_abstraction'
|
|
|
|
require 'rex/io/stream_server'
|
2005-12-13 07:08:40 +01:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Sockets
|
|
|
|
require 'rex/socket'
|
2005-12-13 07:08:40 +01:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Protocols
|
|
|
|
require 'rex/proto'
|
2012-07-10 00:39:26 +02:00
|
|
|
require 'rex/mac_oui'
|
2006-07-27 02:59:00 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Parsers
|
|
|
|
require 'rex/parser/arguments'
|
|
|
|
require 'rex/parser/ini'
|
2006-07-27 02:59:00 +02:00
|
|
|
|
2011-05-12 01:28:12 +02:00
|
|
|
|
2011-05-12 22:03:55 +02:00
|
|
|
# Compatibility
|
|
|
|
require 'rex/compat'
|
2011-05-12 01:28:12 +02:00
|
|
|
|
2013-02-20 22:33:24 +01:00
|
|
|
# SSLScan
|
2013-02-12 00:08:14 +01:00
|
|
|
require 'rex/sslscan/scanner'
|
|
|
|
require 'rex/sslscan/result'
|
|
|
|
|
2006-12-02 20:48:10 +01:00
|
|
|
|
2005-09-16 05:29:11 +02:00
|
|
|
# Overload the Kernel.sleep() function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
2013-08-30 23:28:33 +02:00
|
|
|
def sleep(seconds=nil)
|
|
|
|
Rex::ThreadSafe.sleep(seconds)
|
|
|
|
end
|
2005-09-16 05:29:11 +02:00
|
|
|
")
|
|
|
|
|
2005-09-27 07:31:48 +02:00
|
|
|
# Overload the Kernel.select function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
2013-08-30 23:28:33 +02:00
|
|
|
def select(rfd = nil, wfd = nil, efd = nil, to = nil)
|
|
|
|
Rex::ThreadSafe.select(rfd, wfd, efd, to)
|
|
|
|
end
|
2008-11-16 22:10:35 +01:00
|
|
|
")
|