Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/rex.rb
Views: 11704
# -*- coding: binary -*-1=begin23The Metasploit Rex library is provided under the 3-clause BSD license.45Copyright (c) 2005-2014, Rapid7, Inc.6All rights reserved.78Redistribution and use in source and binary forms, with or without modification,9are permitted provided that the following conditions are met:1011* Redistributions of source code must retain the above copyright notice, this12list of conditions and the following disclaimer.1314* Redistributions in binary form must reproduce the above copyright notice,15this list of conditions and the following disclaimer in the documentation16and/or other materials provided with the distribution.1718* Neither the name of Rapid7, Inc. nor the names of its contributors may be19used to endorse or promote products derived from this software without20specific prior written permission.2122THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND23ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED24WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE25DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR26ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES27(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;28LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON29ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT30(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS31SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.3233=end3435module Rex36Root = File.join(File.expand_path(File.dirname(__FILE__)), 'rex')37LogSource = "rex"38end3940#41# REX Gems42#4344# Text manipulation library for things like generating random string45require 'rex/text'46# Library for Generating Randomized strings valid as Identifiers such as variable names47require 'rex/random_identifier'48# library for creating Powershell scripts for exploitation purposes49require 'rex/powershell'50# Library for processing and creating Zip compatible archives51require 'rex/zip'52# Library for parsing offline Windows Registry files53require 'rex/registry'54# Library for parsing Java serialized streams55require 'rex/java'56# Library for creating C-style Structs57require 'rex/struct2'58# Library for working with OLE59require 'rex/ole'60# Library for creating and/or parsing MIME messages61require 'rex/mime'62# Library for polymorphic encoders63require 'rex/encoder'64# Architecture subsystem65require 'rex/arch'66# Exploit Helper Library67require 'rex/exploitation'6869# Generic classes70require 'rex/file'7172# Thread safety and synchronization73require 'rex/sync'7475# Assembly76require 'rex/assembly/nasm'7778# Logging79require 'rex/logging/log_dispatcher'8081# IO82require 'rex/io/stream'83require 'rex/io/stream_abstraction'84require 'rex/io/stream_server'8586# Sockets87require 'rex/socket'8889# Compatibility90require 'rex/compat'9192# SSLScan93require 'rex/sslscan/scanner'94require 'rex/sslscan/result'9596# Versions97require 'rex/version'9899# Overload the Kernel.sleep() function to be thread-safe100Kernel.class_eval(<<-EOF, __FILE__, __LINE__ + 1)101def sleep(seconds=nil)102Rex::ThreadSafe.sleep(seconds)103end104EOF105106# Overload the Kernel.select function to be thread-safe107Kernel.class_eval(<<-EOF, __FILE__, __LINE__ + 1)108def select(rfd = nil, wfd = nil, efd = nil, to = nil)109Rex::ThreadSafe.select(rfd, wfd, efd, to)110end111EOF112113# Add the deprecated File.exists? method to call non-deprecated File.exist?114File.class_eval(<<-EOF, __FILE__, __LINE__ + 1)115def File.exists?(fname)116File.exist?(fname)117end118EOF119120121