2006-09-01 15:50:10 +00:00
|
|
|
=begin
|
|
|
|
|
|
|
|
The Metasploit Rex library is provided under the 3-clause BSD license.
|
|
|
|
|
|
|
|
Copyright (c) 2005-2006, Metasploit LLC
|
|
|
|
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.
|
|
|
|
|
|
|
|
* Neither the name of Metasploit LLC nor the names of its contributors may be
|
|
|
|
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
|
2005-07-18 07:46:54 +00:00
|
|
|
Root = File.join(File.dirname(__FILE__), 'rex')
|
2005-10-30 23:40:27 +00:00
|
|
|
LogSource = "rex"
|
2005-06-03 04:51:51 +00:00
|
|
|
end
|
|
|
|
|
2005-06-04 08:23:16 +00:00
|
|
|
# Generic classes
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/constants'
|
|
|
|
require 'rex/exceptions'
|
|
|
|
require 'rex/transformer'
|
2005-07-10 07:15:20 +00:00
|
|
|
require 'rex/text'
|
2005-07-22 03:32:06 +00:00
|
|
|
require 'rex/time'
|
2005-09-22 04:53:46 +00:00
|
|
|
require 'rex/job_container'
|
2005-11-02 14:18:50 +00:00
|
|
|
require 'rex/file'
|
2005-07-17 00:52:47 +00:00
|
|
|
|
|
|
|
# Thread safety and synchronization
|
2006-08-21 22:50:27 +00:00
|
|
|
require 'rex/sync'
|
2005-07-10 20:49:13 +00:00
|
|
|
|
|
|
|
# Encoding
|
|
|
|
require 'rex/encoder/xor'
|
|
|
|
require 'rex/encoding/xor'
|
|
|
|
|
|
|
|
# Architecture subsystem
|
2005-10-01 05:55:15 +00:00
|
|
|
require 'rex/arch'
|
2005-06-04 08:23:16 +00:00
|
|
|
|
2005-12-08 15:37:10 +00:00
|
|
|
# Assembly
|
|
|
|
require 'rex/assembly/nasm'
|
|
|
|
|
2005-06-04 08:23:16 +00:00
|
|
|
# Logging
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/logging/log_dispatcher'
|
2005-06-04 08:23:16 +00:00
|
|
|
|
|
|
|
# IO
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/io/stream'
|
2006-02-21 03:10:58 +00:00
|
|
|
require 'rex/io/stream_abstraction'
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/io/stream_server'
|
2005-06-03 04:51:51 +00:00
|
|
|
|
2005-06-04 08:23:16 +00:00
|
|
|
# Sockets
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/socket'
|
2005-06-04 08:23:16 +00:00
|
|
|
|
2005-12-13 06:08:40 +00:00
|
|
|
# Protocols
|
|
|
|
|
|
|
|
require 'rex/proto'
|
|
|
|
|
2005-07-10 07:15:20 +00:00
|
|
|
# Parsers
|
|
|
|
require 'rex/parser/arguments'
|
2005-07-15 22:30:04 +00:00
|
|
|
require 'rex/parser/ini'
|
2005-09-16 03:29:11 +00:00
|
|
|
|
2006-07-27 00:59:00 +00:00
|
|
|
|
|
|
|
# Compatibility
|
|
|
|
require 'rex/compat'
|
|
|
|
|
2005-09-16 03:29:11 +00:00
|
|
|
# Overload the Kernel.sleep() function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
2006-04-30 19:49:27 +00:00
|
|
|
def sleep(seconds)
|
2005-09-16 03:29:11 +00:00
|
|
|
Rex::ThreadSafe.sleep(seconds)
|
|
|
|
end
|
|
|
|
")
|
|
|
|
|
2005-09-27 05:31:48 +00:00
|
|
|
# Overload the Kernel.select function to be thread-safe
|
|
|
|
Kernel.class_eval("
|
|
|
|
def select(rfd = nil, wfd = nil, efd = nil, to = nil)
|
|
|
|
Rex::ThreadSafe.select(rfd, wfd, efd, to)
|
|
|
|
end
|
|
|
|
")
|
|
|
|
|