Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround

git-svn-id: file:///home/svn/framework3/trunk@12600 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-05-12 20:03:55 +00:00
parent 95d802754b
commit 9ce47c01bd
104 changed files with 489 additions and 864 deletions

View File

@ -22,20 +22,19 @@ require 'msf/core'
require 'msf/base/config' require 'msf/base/config'
require 'msf/base/logging' require 'msf/base/logging'
module Msf
# Simple wrapper # Simple wrapper
autoload :Simple, 'msf/base/simple' require 'msf/base/simple'
# Sessions # Sessions
autoload :Sessions, 'msf/base/sessions' require 'msf/base/sessions/command_shell'
require 'msf/base/sessions/tty'
# Serialization # Serialization
autoload :Serializer, 'msf/base/serializer/readable_text' require 'msf/base/serializer/readable_text'
# Persistent Storage # Persistent Storage
autoload :PersistentStorage, 'msf/base/persistent_storage' require 'msf/base/persistent_storage'
# Utilities # Utilities
autoload :Util, 'msf/util' require 'msf/util'
end

View File

@ -1,5 +1,4 @@
require 'rex' require 'rex'
require 'rex/logging'
require 'msf/base' require 'msf/base'
module Msf module Msf

View File

@ -1,19 +0,0 @@
module Msf
module Sessions
autoload :CommandShell, 'msf/base/sessions/command_shell'
autoload :CommandShellWindows, 'msf/base/sessions/command_shell'
autoload :CommandShellUnix, 'msf/base/sessions/command_shell'
autoload :Meterpreter, 'msf/base/sessions/meterpreter'
autoload :Meterpreter_Java_Java, 'msf/base/sessions/meterpreter_java'
autoload :Meterpreter_Php_Php, 'msf/base/sessions/meterpreter_php'
autoload :Meterpreter_x64_Win, 'msf/base/sessions/meterpreter_x64_win'
autoload :Meterpreter_x86_BSD, 'msf/base/sessions/meterpreter_x86_bsd'
autoload :Meterpreter_x86_Linux, 'msf/base/sessions/meterpreter_x86_linux'
autoload :Meterpreter_x86_Win, 'msf/base/sessions/meterpreter_x86_win'
autoload :VncInject, 'msf/base/sessions/vncinject'
autoload :TTY, 'msf/base/sessions/tty'
end
end

View File

@ -4,6 +4,7 @@
require 'msf/base' require 'msf/base'
require 'msf/base/sessions/scriptable' require 'msf/base/sessions/scriptable'
require 'rex/post/meterpreter'
module Msf module Msf
module Sessions module Sessions

View File

@ -1,4 +1,5 @@
require 'msf/base' require 'msf/base'
require 'rex/services/local_relay'
module Msf module Msf
module Sessions module Sessions

View File

@ -1,17 +1,15 @@
module Msf::Simple
# Buffer management # Buffer management
autoload :Buffer, 'msf/base/simple/buffer' require 'msf/base/simple/buffer'
autoload :Statistics, 'msf/base/simple/statistics' require 'msf/base/simple/statistics'
# Simplified module interfaces # Simplified module interfaces
autoload :Module, 'msf/base/simple/module' require 'msf/base/simple/module'
autoload :Encoder, 'msf/base/simple/encoder' require 'msf/base/simple/encoder'
autoload :Exploit, 'msf/base/simple/exploit' require 'msf/base/simple/exploit'
autoload :Nop, 'msf/base/simple/nop' require 'msf/base/simple/nop'
autoload :Payload, 'msf/base/simple/payload' require 'msf/base/simple/payload'
autoload :Auxiliary, 'msf/base/simple/auxiliary' require 'msf/base/simple/auxiliary'
autoload :Post, 'msf/base/simple/post' require 'msf/base/simple/post'
# Simplified framework interface # Simplified framework interface
autoload :Framework, 'msf/base/simple/framework' require 'msf/base/simple/framework'
end

View File

@ -14,39 +14,10 @@ require 'msf/sanity'
# The framework-core depends on Rex # The framework-core depends on Rex
require 'rex' require 'rex'
require 'rex/ui'
# Set the log source, and initialize demand-loaded requires
module Msf module Msf
LogSource = "core" LogSource = "core"
# Event subscriber interfaces
autoload :UiEventSubscriber, 'msf/events'
# Wrappers
autoload :EncodedPayload, 'msf/core/encoded_payload'
# Pseudo-modules
autoload :Handler, 'msf/core/handler'
# Mixins
autoload :Encoder, 'msf/core/encoder'
autoload :EncoderState, 'msf/core/encoder'
autoload :Auxiliary, 'msf/core/auxiliary'
autoload :Nop, 'msf/core/nop'
autoload :Payload, 'msf/core/payload'
autoload :ExploitEvent, 'msf/core/exploit'
autoload :Exploit, 'msf/core/exploit'
autoload :Post, 'msf/core/post'
# Drivers
autoload :ExploitDriver, 'msf/core/exploit_driver'
# Framework context and core classes
autoload :Framework, 'msf/core/framework'
# Session stuff
autoload :Session, 'msf/core/session'
autoload :SessionEvent, 'msf/core/session'
end end
# General # General
@ -55,5 +26,35 @@ require 'msf/core/exceptions'
require 'msf/core/data_store' require 'msf/core/data_store'
require 'msf/core/option_container' require 'msf/core/option_container'
# Event subscriber interfaces
require 'msf/events'
# Framework context and core classes
require 'msf/core/framework'
require 'msf/core/db_manager'
require 'msf/core/event_dispatcher'
require 'msf/core/module_manager'
require 'msf/core/plugin_manager'
require 'msf/core/session'
require 'msf/core/session_manager'
# Wrappers
require 'msf/core/encoded_payload'
# Pseudo-modules
require 'msf/core/handler'
# Modules # Modules
require 'msf/core/module' require 'msf/core/module'
require 'msf/core/encoder'
require 'msf/core/auxiliary'
require 'msf/core/exploit'
require 'msf/core/nop'
require 'msf/core/payload'
require 'msf/core/post'
# Drivers
require 'msf/core/exploit_driver'

View File

@ -5,35 +5,17 @@
# #
# Auxiliary mixins # Auxiliary mixins
# #
module Msf require 'msf/core/auxiliary/auth_brute'
class Auxiliary require 'msf/core/auxiliary/dos'
# Main types of auxiliary modules require 'msf/core/auxiliary/fuzzer'
autoload :AuthBrute, 'msf/core/auxiliary/auth_brute' require 'msf/core/auxiliary/report'
autoload :Dos, 'msf/core/auxiliary/dos' require 'msf/core/auxiliary/scanner'
autoload :Fuzzer, 'msf/core/auxiliary/fuzzer' require 'msf/core/auxiliary/timed'
autoload :Scanner, 'msf/core/auxiliary/scanner' require 'msf/core/auxiliary/wmapmodule'
autoload :Timed, 'msf/core/auxiliary/timed' require 'msf/core/auxiliary/crawler'
# WMAP require 'msf/core/auxiliary/commandshell'
autoload :WMAPModule, 'msf/core/auxiliary/wmapmodule' require 'msf/core/auxiliary/login'
autoload :WMAPScanSSL, 'msf/core/auxiliary/wmapmodule' require 'msf/core/auxiliary/rservices'
autoload :WMAPScanFile, 'msf/core/auxiliary/wmapmodule' require 'msf/core/auxiliary/cisco'
autoload :WMAPScanDir, 'msf/core/auxiliary/wmapmodule' require 'msf/core/auxiliary/nmap'
autoload :WMAPScanServer, 'msf/core/auxiliary/wmapmodule'
autoload :WMAPScanQuery, 'msf/core/auxiliary/wmapmodule'
autoload :WMAPScanUniqueQuery, 'msf/core/auxiliary/wmapmodule'
autoload :WMAPScanGeneric, 'msf/core/auxiliary/wmapmodule'
autoload :WMAPCrawler, 'msf/core/auxiliary/wmapmodule'
autoload :HttpCrawler, 'msf/core/auxiliary/crawler'
# Miscallaneous
autoload :Report, 'msf/core/auxiliary/report'
autoload :CommandShell, 'msf/core/auxiliary/commandshell'
autoload :Nmap, 'msf/core/auxiliary/nmap'
# Protocol augmenters for Aux modules
autoload :Login, 'msf/core/auxiliary/login'
autoload :RServices, 'msf/core/auxiliary/rservices'
autoload :Cisco, 'msf/core/auxiliary/cisco'
end
end

View File

@ -1,3 +1,4 @@
require 'rex/parser/nmap_xml'
require 'open3' require 'open3'
module Msf module Msf

View File

@ -1,10 +1,16 @@
require 'rex/parser/nmap_xml'
autoload :FileUtils, 'fileutils' require 'rex/parser/nexpose_xml'
autoload :Zip, 'zip' require 'rex/parser/retina_xml'
autoload :URI, 'uri' require 'rex/parser/netsparker_xml'
autoload :PacketFu, 'packetfu' require 'rex/parser/nessus_xml'
require 'rex/parser/ip360_xml'
require 'rex/parser/ip360_aspl_xml'
require 'rex/socket'
require 'zip'
require 'packetfu'
require 'uri'
require 'tmpdir' require 'tmpdir'
require 'fileutils'
module Msf module Msf
@ -2064,7 +2070,7 @@ class DBManager
end end
# Returns one of: :nexpose_simplexml :nexpose_rawxml :nmap_xml :openvas_xml # Returns one of: :nexpose_simplexml :nexpose_rawxml :nmap_xml :openvas_xml
# :nessus_xml :nessus_xml_v2 :qualys_scan_xml, :qualys_asset_xml, :msf_xml :nessus_nbe :amap_mlog # :nessus_xml :nessus_xml_v2 :qualys_xml :msf_xml :nessus_nbe :amap_mlog
# :amap_log :ip_list, :msf_zip, :libpcap # :amap_log :ip_list, :msf_zip, :libpcap
# If there is no match, an error is raised instead. # If there is no match, an error is raised instead.
def import_filetype_detect(data) def import_filetype_detect(data)
@ -2134,11 +2140,8 @@ class DBManager
@import_filedata[:type] = "Nessus XML (v2)" @import_filedata[:type] = "Nessus XML (v2)"
return :nessus_xml_v2 return :nessus_xml_v2
when "SCAN" when "SCAN"
@import_filedata[:type] = "Qualys Scan XML" @import_filedata[:type] = "Qualys XML"
return :qualys_scan_xml return :qualys_xml
when "ASSET_DATA_REPORT"
@import_filedata[:type] = "Qualys Asset XML"
return :qualys_asset_xml
when /MetasploitExpressV[1234]/ when /MetasploitExpressV[1234]/
@import_filedata[:type] = "Metasploit XML" @import_filedata[:type] = "Metasploit XML"
return :msf_xml return :msf_xml
@ -4378,114 +4381,10 @@ class DBManager
REXML::Document.parse_stream(data, parser) REXML::Document.parse_stream(data, parser)
end end
def find_qualys_asset_vuln_refs(doc)
vuln_refs = {}
doc.elements.each("/ASSET_DATA_REPORT/GLOSSARY/VULN_DETAILS_LIST/VULN_DETAILS") do |vuln|
next unless vuln.elements['QID'] && vuln.elements['QID'].first
qid = vuln.elements['QID'].first.to_s
vuln_refs[qid] ||= []
if vuln.elements["CVE_ID_LIST/CVE_ID/ID"]
vuln.elements["CVE_ID_LIST/CVE_ID/ID"].each do |ref|
next unless ref
next unless ref.to_s[/^C..-[0-9\-]{9}/]
vuln_refs[qid] << ref.to_s.gsub(/^C../, "CVE")
end
end
if vuln.elements["BUGTRAQ_ID_LIST/BUGTRAQ_ID/ID"]
vuln.elements["BUGTRAQ_ID_LIST/BUGTRAQ_ID/ID"].each do |ref|
next unless ref
next unless ref.to_s[/^[0-9]{1,9}/]
vuln_refs[qid] << "BID-#{ref}"
end
end
end
return vuln_refs
end
# Pull out vulnerabilities that have at least one matching
# ref -- many "vulns" are not vulns, just audit information.
def find_qualys_asset_vulns(host,wspace,hobj,vuln_refs,&block)
host.elements.each("VULN_INFO_LIST/VULN_INFO") do |vi|
next unless vi.elements["QID"]
vi.elements.each("QID") do |qid|
next if vuln_refs[qid.text].nil? || vuln_refs[qid.text].empty?
handle_qualys(wspace, hobj, nil, nil, qid.text, nil, vuln_refs[qid.text], nil)
end
end
end
# Takes QID numbers and finds the discovered services in
# a qualys_asset_xml.
def find_qualys_asset_ports(i,host,wspace,hobj)
return unless (i == 82023 || i == 82004)
proto = i == 82023 ? 'tcp' : 'udp'
qid = host.elements["VULN_INFO_LIST/VULN_INFO/QID[@id='qid_#{i}']"]
qid_result = qid.parent.elements["RESULT[@format='table']"] if qid
hports = qid_result.first.to_s if qid_result
if hports
hports.scan(/([0-9]+)\t(.*?)\t.*?\t([^\t\n]*)/) do |match|
if match[2] == nil or match[2].strip == 'unknown'
name = match[1].strip
else
name = match[2].strip
end
handle_qualys(wspace, hobj, match[0].to_s, proto, 0, nil, nil, name)
end
end
end
# #
# Import Qualys's Asset Data Report format # Import Qualys' xml output
# #
def import_qualys_asset_xml(args={}, &block) def import_qualys_xml_file(args={})
data = args[:data]
wspace = args[:wspace] || workspace
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
doc = rexmlify(data)
vuln_refs = find_qualys_asset_vuln_refs(doc)
# 2nd pass, actually grab the hosts.
doc.elements.each("/ASSET_DATA_REPORT/HOST_LIST/HOST") do |host|
hobj = nil
addr = host.elements["IP"].text if host.elements["IP"]
next unless validate_ips(addr)
if bl.include? addr
next
else
yield(:address,addr) if block
end
hname = ( # Prefer NetBIOS over DNS
(host.elements["NETBIOS"].text if host.elements["NETBIOS"]) ||
(host.elements["DNS"].text if host.elements["DNS"]) ||
"" )
hobj = report_host(:workspace => wspace, :host => addr, :name => hname, :state => Msf::HostState::Alive)
report_import_note(wspace,hobj)
if host.elements["OPERATING_SYSTEM"]
hos = host.elements["OPERATING_SYSTEM"].text
report_note(
:workspace => wspace,
:host => hobj,
:type => 'host.os.qualys_fingerprint',
:data => { :os => hos }
)
end
# Report open ports.
find_qualys_asset_ports(82023,host,wspace,hobj) # TCP
find_qualys_asset_ports(82004,host,wspace,hobj) # UDP
# Report vulns
find_qualys_asset_vulns(host,wspace,hobj,vuln_refs,&block)
end # host
end
#
# Import Qualys' Scan xml output
#
def import_qualys_scan_xml_file(args={})
filename = args[:filename] filename = args[:filename]
wspace = args[:wspace] || workspace wspace = args[:wspace] || workspace
@ -4493,10 +4392,10 @@ class DBManager
::File.open(filename, 'rb') do |f| ::File.open(filename, 'rb') do |f|
data = f.read(f.stat.size) data = f.read(f.stat.size)
end end
import_qualys_scan_xml(args.merge(:data => data)) import_qualys_xml(args.merge(:data => data))
end end
def import_qualys_scan_xml(args={}, &block) def import_qualys_xml(args={}, &block)
data = args[:data] data = args[:data]
wspace = args[:wspace] || workspace wspace = args[:wspace] || workspace
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : [] bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
@ -4950,7 +4849,7 @@ protected
# #
def handle_qualys(wspace, hobj, port, protocol, qid, severity, refs, name=nil) def handle_qualys(wspace, hobj, port, protocol, qid, severity, refs, name=nil)
addr = hobj.address addr = hobj.address
port = port.to_i if port port = port.to_i
info = { :workspace => wspace, :host => hobj, :port => port, :proto => protocol } info = { :workspace => wspace, :host => hobj, :port => port, :proto => protocol }
if name and name != 'unknown' if name and name != 'unknown'

View File

@ -156,48 +156,6 @@ class Exploit < Msf::Module
### ###
class Remote < Exploit class Remote < Exploit
# Protocol - layer 3
autoload :Ip, 'msf/core/exploit/ip'
autoload :Ipv6, 'msf/core/exploit/ipv6'
# Protocol - layer 4
autoload :Tcp, 'msf/core/exploit/tcp'
autoload :TcpServer, 'msf/core/exploit/tcp'
autoload :Udp, 'msf/core/exploit/udp'
# Protocol - layer 5
autoload :Ftp, 'msf/core/exploit/ftp'
autoload :FtpServer, 'msf/core/exploit/ftpserver'
autoload :Telnet, 'msf/core/exploit/telnet'
autoload :HttpClient, 'msf/core/exploit/http/client'
autoload :HttpServer, 'msf/core/exploit/http/server'
autoload :Smtp, 'msf/core/exploit/smtp'
autoload :Imap, 'msf/core/exploit/imap'
autoload :Pop2, 'msf/core/exploit/pop2'
autoload :SMTPDeliver, 'msf/core/exploit/smtp_deliver'
autoload :SMB, 'msf/core/exploit/smb'
autoload :SMBServer, 'msf/core/exploit/smb'
autoload :DCERPC, 'msf/core/exploit/dcerpc'
autoload :SunRPC, 'msf/core/exploit/sunrpc'
autoload :MSSQL, 'msf/core/exploit/mssql'
autoload :MSSQL_COMMANDS, 'msf/core/exploit/mssql_commands'
autoload :MSSQL_SQLI, 'msf/core/exploit/mssql_sqli'
autoload :MYSQL, 'msf/core/exploit/mysql'
autoload :TNS, 'msf/core/exploit/tns'
autoload :DB2, 'msf/core/exploit/db2'
autoload :Postgres, 'msf/core/exploit/postgres'
autoload :SNMPClient, 'msf/core/exploit/snmp'
autoload :Arkeia, 'msf/core/exploit/arkeia'
autoload :NDMP, 'msf/core/exploit/ndmp'
autoload :WDBRPC, 'msf/core/exploit/wdbrpc'
autoload :WDBRPC_Client, 'msf/core/exploit/wdbrpc_client'
autoload :BrowserAutopwn, 'msf/core/exploit/browser_autopwn'
autoload :Dialup, 'msf/core/exploit/dialup'
# #
# Initializes the socket array. # Initializes the socket array.
# #

View File

@ -205,7 +205,7 @@ module Exploit::Capture
capture_file.setfilter(filter) if filter capture_file.setfilter(filter) if filter
while (pkt = capture_file.next) do while (pkt = capture_file.next) do
pcap.inject(pkt) pcap.inject(pkt)
Kernel.select(nil, nil, nil, (delay * 1.0)/1000) Kernel.select(nil, nil, nil, delay/1000)
end end
GC.start GC.start
end end
@ -373,13 +373,9 @@ module Exploit::Capture
end end
def check_pcaprub_loaded def check_pcaprub_loaded
if not @pcaprub_loaded unless @pcaprub_loaded
print_status("The Pcaprub module is not available: #{@pcaprub_error}") print_status("The Pcaprub module is not available: #{@pcaprub_error}")
raise RuntimeError, "Pcaprub not available" raise RuntimeError, "Pcaprub not available"
#Those methods have been added later
elsif (not Pcap.respond_to? "lookupaddrs")
print_status("The Pcaprub module is not up-to-date")
raise RuntimeError, "The Pcaprub module is missing some functions"
else else
true true
end end

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
## ##
require 'rex/exploitation/cmdstager'
require 'msf/core/exploit/exe' require 'msf/core/exploit/exe'
module Msf module Msf

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
## ##
require 'rex/text'
require 'msf/core/exploit/tftp' require 'msf/core/exploit/tftp'
require 'msf/core/exploit/cmdstager' require 'msf/core/exploit/cmdstager'

View File

@ -13,8 +13,6 @@ module Msf
### ###
module Exploit::CmdStagerVBS module Exploit::CmdStagerVBS
autoload :ADODB, 'msf/core/exploit/cmdstager_vbs_adodb'
include Msf::Exploit::CmdStager include Msf::Exploit::CmdStager
def initialize(info = {}) def initialize(info = {})

View File

@ -1,3 +1,5 @@
require 'rex/proto/dcerpc'
require 'rex/encoder/ndr'
require 'msf/core/exploit/dcerpc_epm' require 'msf/core/exploit/dcerpc_epm'
require 'msf/core/exploit/dcerpc_mgmt' require 'msf/core/exploit/dcerpc_mgmt'
require 'msf/core/exploit/dcerpc_lsa' require 'msf/core/exploit/dcerpc_lsa'

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
## ##
require 'rex/proto/dhcp'
module Msf module Msf

View File

@ -1,5 +1,6 @@
# $Id$ # $Id$
require 'rex/exploitation/egghunter'
module Msf module Msf

View File

@ -1,4 +1,8 @@
require 'digest' require 'digest'
require 'rex/proto/ntlm/crypt'
require 'rex/proto/ntlm/constants'
require 'rex/proto/ntlm/utils'
require 'rex/proto/ntlm/exceptions'
module Msf module Msf
### ###

View File

@ -1,3 +1,7 @@
require 'rex/service_manager'
require 'rex/exploitation/obfuscatejs'
require 'rex/exploitation/encryptjs'
require 'rex/exploitation/heaplib'
module Msf module Msf
@ -12,7 +16,6 @@ module Exploit::Remote::HttpServer
include Msf::Exploit::Remote::TcpServer include Msf::Exploit::Remote::TcpServer
include Msf::Auxiliary::Report include Msf::Auxiliary::Report
def initialize(info = {}) def initialize(info = {})
super super

View File

@ -1,5 +1,6 @@
module Msf module Msf
require 'rex/payloads/win32/kernel'
module Exploit::KernelMode module Exploit::KernelMode

View File

@ -3,56 +3,84 @@
# All exploit mixins should be added to the list below # All exploit mixins should be added to the list below
# #
class Msf::Exploit
# Behavior # Behavior
autoload :Brute, 'msf/core/exploit/brute' require 'msf/core/exploit/brute'
autoload :BruteTargets, 'msf/core/exploit/brutetargets' require 'msf/core/exploit/brutetargets'
require 'msf/core/exploit/browser_autopwn'
# Payload # Payload
autoload :Egghunter, 'msf/core/exploit/egghunter' require 'msf/core/exploit/egghunter'
autoload :Omelet, 'msf/core/exploit/omelet' require 'msf/core/exploit/omelet'
autoload :Seh, 'msf/core/exploit/seh' require 'msf/core/exploit/seh'
autoload :KernelMode, 'msf/core/exploit/kernel_mode' require 'msf/core/exploit/kernel_mode'
autoload :EXE, 'msf/core/exploit/exe' require 'msf/core/exploit/exe'
# CmdStagers # CmdStagers
autoload :CmdStager, 'msf/core/exploit/cmdstager' require 'msf/core/exploit/cmdstager'
autoload :CmdStagerVBS, 'msf/core/exploit/cmdstager_vbs' require 'msf/core/exploit/cmdstager_vbs'
autoload :CmdStagerDebugWrite, 'msf/core/exploit/cmdstager_debug_write' require 'msf/core/exploit/cmdstager_vbs_adodb'
autoload :CmdStagerDebugAsm, 'msf/core/exploit/cmdstager_debug_asm' require 'msf/core/exploit/cmdstager_debug_write'
autoload :CmdStagerTFTP, 'msf/core/exploit/cmdstager_tftp' require 'msf/core/exploit/cmdstager_debug_asm'
require 'msf/core/exploit/cmdstager_tftp'
# Protocol utils # Protocol
autoload :NTLM, 'msf/core/exploit/ntlm' require 'msf/core/exploit/tcp'
require 'msf/core/exploit/udp'
require 'msf/core/exploit/ip'
require 'msf/core/exploit/ipv6'
require 'msf/core/exploit/dhcp'
require 'msf/core/exploit/ntlm'
require 'msf/core/exploit/smb'
require 'msf/core/exploit/ftp'
require 'msf/core/exploit/tftp'
require 'msf/core/exploit/telnet'
require 'msf/core/exploit/ftpserver'
require 'msf/core/exploit/http/client'
require 'msf/core/exploit/http/server'
require 'msf/core/exploit/smtp'
require 'msf/core/exploit/dcerpc'
require 'msf/core/exploit/sunrpc'
require 'msf/core/exploit/mssql'
require 'msf/core/exploit/mssql_commands'
require 'msf/core/exploit/mssql_sqli'
require 'msf/core/exploit/mysql'
require 'msf/core/exploit/snmp'
require 'msf/core/exploit/arkeia'
require 'msf/core/exploit/ndmp'
require 'msf/core/exploit/imap'
require 'msf/core/exploit/smtp_deliver'
require 'msf/core/exploit/pop2'
require 'msf/core/exploit/tns'
require 'msf/core/exploit/db2'
require 'msf/core/exploit/postgres'
require 'msf/core/exploit/wdbrpc'
require 'msf/core/exploit/wdbrpc_client'
# Protocol - layer 2
autoload :DHCPServer, 'msf/core/exploit/dhcp'
autoload :TFTPServer, 'msf/core/exploit/tftp'
# Telephony # Telephony
autoload :DECT_COA, 'msf/core/exploit/dect_coa' require 'msf/core/exploit/dialup'
require 'msf/core/exploit/dect_coa'
# Networks # Networks
autoload :Lorcon, 'msf/core/exploit/lorcon' require 'msf/core/exploit/lorcon'
autoload :Lorcon2, 'msf/core/exploit/lorcon2' require 'msf/core/exploit/lorcon2'
autoload :Capture, 'msf/core/exploit/capture' require 'msf/core/exploit/capture'
# FileFormat # FileFormat
autoload :FILEFORMAT, 'msf/core/exploit/fileformat' require 'msf/core/exploit/fileformat'
autoload :PDF_Parse, 'msf/core/exploit/pdf_parse' require 'msf/core/exploit/pdf_parse'
autoload :PDF, 'msf/core/exploit/pdf' require 'msf/core/exploit/pdf'
autoload :RIFF, 'msf/core/exploit/riff' require 'msf/core/exploit/riff'
# Oracle # Oracle
autoload :ORACLE, 'msf/core/exploit/oracle' require 'msf/core/exploit/oracle'
# tekniqz # tekniqz
autoload :FormatString, 'msf/core/exploit/fmtstr' require 'msf/core/exploit/fmtstr'
# Java # Java
autoload :Java, 'msf/core/exploit/java' require 'msf/core/exploit/java'
# WBEM # WBEM
autoload :WbemExec, 'msf/core/exploit/wbemexec' require 'msf/core/exploit/wbemexec'
end

View File

@ -1,5 +1,9 @@
require 'msf/core' require 'msf/core'
require 'msf/core/exploit/mssql_commands' require 'msf/core/exploit/mssql_commands'
require 'rex/proto/ntlm/crypt'
require 'rex/proto/ntlm/constants'
require 'rex/proto/ntlm/utils'
require 'rex/proto/ntlm/exceptions'
module Msf module Msf

View File

@ -1,3 +1,7 @@
require 'rex/proto/ntlm/constants'
require 'rex/proto/ntlm/crypt'
require 'rex/proto/ntlm/base'
require 'rex/proto/ntlm/message'
module Msf module Msf

View File

@ -1,5 +1,6 @@
# $Id$ # $Id$
require 'rex/exploitation/omelet'
module Msf module Msf

View File

@ -1,3 +1,4 @@
require 'rex/exploitation/seh'
module Msf module Msf

View File

@ -3,6 +3,7 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..')) $:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))
require 'test/unit' require 'test/unit'
require 'rex'
require 'msf/core' require 'msf/core'
require 'msf/core/exploit/seh' require 'msf/core/exploit/seh'

View File

@ -1,3 +1,7 @@
require 'rex/proto/smb'
require 'rex/proto/ntlm'
require 'rex/proto/dcerpc'
require 'rex/encoder/ndr'
module Msf module Msf

View File

@ -1,6 +1,7 @@
module Msf module Msf
require 'msf/core/exploit/tcp' require 'msf/core/exploit/tcp'
require 'rex/mime'
### ###
# #

View File

@ -1,3 +1,4 @@
require 'rex/proto/sunrpc'
module Msf module Msf

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
## ##
require 'rex/proto/tftp'
module Msf module Msf

View File

@ -1,3 +1,4 @@
require 'msf/core'
module Msf module Msf
@ -224,7 +225,7 @@ protected
# Wait the payload to acquire a session if this isn't a passive-style # Wait the payload to acquire a session if this isn't a passive-style
# exploit. # exploit.
return if not delay return if not
if (force_wait_for_session == true) or if (force_wait_for_session == true) or
(exploit.passive? == false and exploit.handler_enabled?) (exploit.passive? == false and exploit.handler_enabled?)

View File

@ -1,3 +1,5 @@
require 'rex/io/stream_abstraction'
require 'rex/sync/ref'
module Msf module Msf
module Handler module Handler

View File

@ -1,3 +1,5 @@
require 'rex/io/stream_abstraction'
require 'rex/sync/ref'
module Msf module Msf
module Handler module Handler

View File

@ -1,3 +1,4 @@
require 'rex/socket'
require 'thread' require 'thread'
module Msf module Msf

View File

@ -105,13 +105,12 @@ class Module
true true
end end
autoload :Author, 'msf/core/module/author' require 'msf/core/module/author'
autoload :Platform, 'msf/core/module/platform' require 'msf/core/module/platform_list'
autoload :PlatformList, 'msf/core/module/platform_list' require 'msf/core/module/reference'
autoload :Reference, 'msf/core/module/reference' require 'msf/core/module/target'
autoload :Target, 'msf/core/module/target' require 'msf/core/module/auxiliary_action'
autoload :HasActions, 'msf/core/module/has_actions' require 'msf/core/module/has_actions'
autoload :AuxiliaryAction, 'msf/core/module/auxiliary_action'
# #
# Creates an instance of an abstract module using the supplied information # Creates an instance of an abstract module using the supplied information

View File

@ -1,5 +1,6 @@
require 'resolv' require 'resolv'
require 'msf/core' require 'msf/core'
require 'rex/socket'
module Msf module Msf

View File

@ -1,5 +1,5 @@
require 'msf/core' require 'msf/core'
autoload :Metasm, 'metasm' require 'metasm'
module Msf module Msf
@ -14,19 +14,19 @@ class Payload < Msf::Module
require 'rex/payloads' require 'rex/payloads'
autoload :Single, 'msf/core/payload/single' require 'msf/core/payload/single'
autoload :Generic, 'msf/core/payload/generic' require 'msf/core/payload/generic'
autoload :Stager, 'msf/core/payload/stager' require 'msf/core/payload/stager'
# Platform specific includes # Platform specific includes
autoload :Aix, 'msf/core/payload/aix' require 'msf/core/payload/aix'
autoload :Bsd, 'msf/core/payload/bsd' require 'msf/core/payload/bsd'
autoload :Linux, 'msf/core/payload/linux' require 'msf/core/payload/linux'
autoload :Osx, 'msf/core/payload/osx' require 'msf/core/payload/osx'
autoload :Solaris, 'msf/core/payload/solaris' require 'msf/core/payload/solaris'
autoload :Windows, 'msf/core/payload/windows' require 'msf/core/payload/windows'
autoload :Netware, 'msf/core/payload/netware' require 'msf/core/payload/netware'
autoload :Java, 'msf/core/payload/java' require 'msf/core/payload/java'
## ##
# #

View File

@ -1,5 +1,6 @@
require 'msf/core' require 'msf/core'
require 'rex/peparsey'
module Msf module Msf

View File

@ -1,5 +1,6 @@
require 'msf/core' require 'msf/core'
require 'rex/peparsey'
module Msf module Msf

View File

@ -1,3 +1,4 @@
require 'rex/sync/ref'
module Msf module Msf

View File

@ -1,4 +1,5 @@
require "xmlrpc/client" require "xmlrpc/client"
require "rex"
module Msf module Msf
module RPC module RPC

View File

@ -1,4 +1,5 @@
require 'pp' require 'pp'
require 'rex'
require 'msf/ui/web/driver' require 'msf/ui/web/driver'
module Msf module Msf

View File

@ -1,4 +1,6 @@
require "xmlrpc/server" require "xmlrpc/server"
require 'rex/service_manager'
require "rex"
module Msf module Msf

View File

@ -1,3 +1,5 @@
require 'rex'
require 'rex/ui/text/output/buffer'
module Msf module Msf
module RPC module RPC

View File

@ -84,12 +84,15 @@ module Session
end end
# Direct descendents # Direct descendents
autoload :Interactive, 'msf/core/session/interactive' require 'msf/core/session/interactive'
autoload :Basic, 'msf/core/session/basic' require 'msf/core/session/basic'
autoload :Comm, 'msf/core/session/comm' require 'msf/core/session/comm'
# Provider interfaces # Provider interfaces
autoload :Provider, 'msf/core/session/provider' require 'msf/core/session/provider/single_command_execution'
require 'msf/core/session/provider/multi_command_execution'
require 'msf/core/session/provider/single_command_shell'
require 'msf/core/session/provider/multi_command_shell'
def self.type def self.type
"unknown" "unknown"

View File

@ -1,3 +1,4 @@
require 'rex/socket'
module Msf module Msf
module Session module Session

View File

@ -1,3 +1,5 @@
require 'rex/ui'
require 'rex/io/ring_buffer'
module Msf module Msf
module Session module Session

View File

@ -1,10 +0,0 @@
module Msf
module Session
module Provider
autoload :SingleCommandExecution, 'msf/core/session/provider/single_command_execution'
autoload :MultiCommandExecution, 'msf/core/session/provider/multi_command_execution'
autoload :SingleCommandShell, 'msf/core/session/provider/single_command_shell'
autoload :MultiCommandShell, 'msf/core/session/provider/multi_command_shell'
end
end
end

View File

@ -1,8 +1,10 @@
module Msf module Msf
module Ui module Ui
autoload :Banner, 'msf/ui/banner'
autoload :Driver, 'msf/ui/driver'
autoload :Common, 'msf/ui/common'
autoload :Console, 'msf/ui/console'
end end
end end
require 'rex/ui'
require 'msf/ui/banner'
require 'msf/ui/driver'
require 'msf/ui/common'
require 'msf/ui/console'

View File

@ -1,4 +1,6 @@
require 'rexml/document'
require 'rex/parser/nmap_xml'
require 'msf/core/db_export' require 'msf/core/db_export'
module Msf module Msf
@ -1274,8 +1276,6 @@ class Db
warnings = 0 warnings = 0
framework.db.import_file(:filename => filename) do |type,data| framework.db.import_file(:filename => filename) do |type,data|
case type case type
when :debug
print_status("DEBUG: #{data.inspect}")
when :filetype when :filetype
print_status("Importing '#{data}' data") print_status("Importing '#{data}' data")
when :address when :address

View File

@ -1,3 +1,4 @@
require 'rex/parser/arguments'
module Msf module Msf
module Ui module Ui

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
## ##
require 'rex/parser/arguments'
module Msf module Msf
module Ui module Ui

View File

@ -1,3 +1,4 @@
require 'rex/proto/http'
require 'msf/core' require 'msf/core'
require 'msf/base' require 'msf/base'
require 'msf/ui' require 'msf/ui'
@ -6,6 +7,7 @@ module Msf
module Ui module Ui
module Web module Web
require 'rex/io/bidirectional_pipe'
require 'msf/ui/web/console' require 'msf/ui/web/console'

View File

@ -10,15 +10,16 @@
require 'msf/core' require 'msf/core'
require 'rex'
module Msf module Msf
module Util module Util
end
end
# Executable generation and encoding # Executable generation and encoding
autoload :EXE, 'msf/util/exe' require 'msf/util/exe'
# Parse SVN entries # Parse SVN entries
autoload :SVN, 'msf/util/svn' require 'msf/util/svn'
end
end

View File

@ -13,15 +13,17 @@
# #
### ###
require 'rex'
autoload :Metasm, 'metasm'
require 'digest/sha1'
module Msf module Msf
module Util module Util
class EXE class EXE
require 'rex'
require 'rex/peparsey'
require 'rex/pescan'
require 'rex/zip'
require 'metasm'
require 'digest/sha1'
## ##
# #
# Helper functions common to multiple generators # Helper functions common to multiple generators
@ -558,70 +560,28 @@ class EXE
return mo return mo
end end
#
# Create a 32-bit Linux ELF containing the payload provided in +code+
#
# For the default template, this method just appends the payload. For
# user-provided templates, modifies the header to mark all executable
# segments as writable and overwrites the entrypoint (usually _start) with
# the payload.
#
def self.to_linux_x86_elf(framework, code, opts={}) def self.to_linux_x86_elf(framework, code, opts={})
unless opts[:template]
default = true
end
# Allow the user to specify their own template # Allow the user to specify their own template
set_template_default(opts, "template_x86_linux.bin") set_template_default(opts, "template_x86_linux.bin")
elf = ''
File.open(opts[:template], "rb") { |fd|
elf = fd.read(fd.stat.size)
}
# The old way to do it is like other formats, just overwrite a big # The old way to do it is like other formats, just overwrite a big
# block of rwx mem with our shellcode. # block of rwx mem with our shellcode.
#bo = elf.index( "\x90\x90\x90\x90" * 1024 ) #bo = elf.index( "\x90\x90\x90\x90" * 1024 )
#co = elf.index( " " * 512 ) #co = elf.index( " " * 512 )
#elf[bo, 2048] = [code].pack('a2048') if bo #elf[bo, 2048] = [code].pack('a2048') if bo
if default
# The new template is just an ELF header with its entry point set to # The new template is just an ELF header with its entry point set to
# the end of the file, so just append shellcode to it and fixup # the end of the file, so just append shellcode to it and fixup
# p_filesz and p_memsz in the header for a working ELF executable. # p_filesz and p_memsz in the header for a working ELF executable.
elf = ''
File.open(opts[:template], "rb") { |fd|
elf = fd.read(fd.stat.size)
}
elf << code elf << code
elf[0x44,4] = [elf.length + code.length].pack('V') elf[0x44,4] = [elf.length + code.length].pack('V')
elf[0x48,4] = [elf.length + code.length].pack('V') elf[0x48,4] = [elf.length + code.length].pack('V')
else
# If this isn't our normal template, we have to do some fancy
# header patching to mark the .text section rwx before putting our
# payload into the entry point.
# read in the template and parse it
e = Metasm::ELF.decode_file(opts[:template])
# This will become a modified copy of the template's original phdr
new_phdr = Metasm::EncodedData.new
e.segments.each { |s|
# Be lazy and mark any executable segment as writable. Doing
# it this way means we don't have to care about which one
# contains .text
if s.flags.include? "X"
s.flags += [ "W" ]
end
new_phdr << s.encode(e)
}
# Copy the original file
elf = File.read(opts[:template])
# Replace the header with our rwx modified version
elf[e.header.phoff, new_phdr.data.length] = new_phdr.data
# Replace code at the entrypoint with our payload
entry_off = e.addr_to_off(e.label_addr('entrypoint'))
elf[entry_off, code.length] = code
end
return elf return elf
end end

View File

@ -40,77 +40,53 @@ end
# Generic classes # Generic classes
require 'rex/constants' require 'rex/constants'
require 'rex/exceptions' require 'rex/exceptions'
require 'rex/transformer'
module Rex require 'rex/text'
# Generic modules require 'rex/time'
autoload :FileUtils, 'rex/file' require 'rex/job_container'
autoload :Find, 'rex/file' require 'rex/file'
autoload :Quickfile, 'rex/file'
autoload :Text, 'rex/text'
autoload :Job, 'rex/job_container'
autoload :JobContainer, 'rex/job_container'
autoload :Transformer, 'rex/transformer'
autoload :ExtTime, 'rex/time'
autoload :Zip, 'rex/zip'
# Thread safety and synchronization # Thread safety and synchronization
autoload :ReadWriteLock, 'rex/sync/read_write_lock' require 'rex/sync'
autoload :ThreadSafe, 'rex/sync/thread_safe'
autoload :Ref, 'rex/sync/ref'
autoload :Sync, 'rex/sync/event'
# Thread factory # Thread factory
autoload :ThreadFactory, 'rex/thread_factory' require 'rex/thread_factory'
# Encoding # Encoding
autoload :Encoder, 'rex/encoder' require 'rex/encoder/xor'
autoload :Encoders, 'rex/encoders' require 'rex/encoding/xor'
autoload :Encoding, 'rex/encoding'
# Architecture subsystem # Architecture subsystem
autoload :Arch, 'rex/arch' require 'rex/arch'
# Assembly # Assembly
autoload :Assembly, 'rex/assembly/nasm' require 'rex/assembly/nasm'
# Logging # Logging
autoload :Logging, 'rex/logging' require 'rex/logging/log_dispatcher'
# IO # IO
autoload :IO, 'rex/io' require 'rex/io/stream'
require 'rex/io/stream_abstraction'
require 'rex/io/stream_server'
# Sockets # Sockets
autoload :Socket, 'rex/socket' require 'rex/socket'
# Platforms
autoload :Platforms, 'rex/platforms'
# Protocols # Protocols
autoload :Proto, 'rex/proto'
# Service handling require 'rex/proto'
autoload :Service, 'rex/service'
autoload :ServiceManager, 'rex/service_manager'
# Parsers # Parsers
autoload :Parser, 'rex/parser' require 'rex/parser/arguments'
require 'rex/parser/ini'
# Compatibility # Compatibility
autoload :Compat, 'rex/compat' require 'rex/compat'
# User interface # Platforms
autoload :Ui, 'rex/ui' require 'rex/platforms'
# Meterpreter
autoload :Post, 'rex/post'
autoload :Script, 'rex/script'
# PE Parsing
autoload :PeParsey, 'rex/peparsey'
# Exploit techniques
autoload :Exploitation, 'rex/exploitation'
end
# Overload the Kernel.sleep() function to be thread-safe # Overload the Kernel.sleep() function to be thread-safe

View File

@ -2,6 +2,7 @@ require 'rex/constants'
module Rex module Rex
### ###
# #
# This module provides generalized methods for performing operations that are # This module provides generalized methods for performing operations that are
@ -14,8 +15,8 @@ module Arch
# #
# Architecture classes # Architecture classes
# #
autoload :X86, 'rex/arch/x86' require 'rex/arch/x86'
autoload :Sparc, 'rex/arch/sparc' require 'rex/arch/sparc'
# #
# This routine adjusts the stack pointer for a given architecture. # This routine adjusts the stack pointer for a given architecture.

View File

@ -1,17 +0,0 @@
##
# $Id$
#
# This file maps encoders for autoload
##
module Rex::Encoder
# Encoder support code
autoload :Xor, 'rex/encoder/xor'
autoload :Alpha2, 'rex/encoder/alpha2'
autoload :NonAlpha, 'rex/encoder/nonalpha'
autoload :NonUpper, 'rex/encoder/nonupper'
# Hrm? Is these in the wrong module?
autoload :XDR, 'rex/encoder/xdr'
autoload :NDR, 'rex/encoder/ndr'
end

View File

@ -18,16 +18,14 @@
module Rex module Rex
module Encoder module Encoder
module Alpha2 module Alpha2
end end end
# #
# autoload the Alpha2 encoders # include the Alpha2 encodings
# #
autoload :Generic, 'rex/encoder/alpha2/generic'
autoload :AlphaMixed, 'rex/encoder/alpha2/alpha_mixed'
autoload :AlphaUpper, 'rex/encoder/alpha2/alpha_upper'
autoload :UnicodeMixed, 'rex/encoder/alpha2/unicode_mixed'
autoload :UnicodeUpper, 'rex/encoder/alpha2/unicode_upper'
end require 'rex/encoder/alpha2/generic'
end require 'rex/encoder/alpha2/alpha_mixed'
end require 'rex/encoder/alpha2/alpha_upper'
require 'rex/encoder/alpha2/unicode_mixed'
require 'rex/encoder/alpha2/unicode_upper'

View File

@ -10,9 +10,6 @@ module Encoder
### ###
class Xor class Xor
autoload :Dword, 'rex/encoder/xor/dword'
autoload :DwordAdditive, 'rex/encoder/xor/dword_additive'
attr_accessor :raw, :encoded, :badchars, :opts, :key, :fkey # :nodoc: attr_accessor :raw, :encoded, :badchars, :opts, :key, :fkey # :nodoc:
# #
@ -68,5 +65,5 @@ class Xor
end end
end end end
end

View File

@ -1,11 +0,0 @@
##
# $Id$
#
# This file maps encoders for autoload
##
require 'rex'
module Rex::Encoders
autoload :XorDword, 'rex/encoders/xor_dword'
autoload :XorDwordAdditive, 'rex/encoders/xor_dword_additive'
end

View File

@ -1,10 +0,0 @@
##
# $Id$
#
# This file maps encodings for autoload
##
module Rex::Encoding
# Encoding support code
autoload :Xor, 'rex/encoding/xor'
end

View File

@ -1,19 +1,20 @@
#!/usr/bin/env ruby
#
# make sure the namespace is created
#
module Rex module Rex
module Encoding module Encoding
module Xor module Xor
end end end
# #
# autoload the Xor encodings # include the Xor encodings
# #
autoload :Generic, 'rex/encoding/xor/generic'
autoload :Byte, 'rex/encoding/xor/byte'
autoload :Word, 'rex/encoding/xor/word'
autoload :Dword, 'rex/encoding/xor/dword'
autoload :DwordAdditive, 'rex/encoding/xor/dword_additive'
autoload :Qword, 'rex/encoding/xor/qword'
autoload :Exception, 'rex/encoding/xor/exceptions' require 'rex/encoding/xor/generic'
require 'rex/encoding/xor/byte'
end require 'rex/encoding/xor/word'
end require 'rex/encoding/xor/dword'
end require 'rex/encoding/xor/qword'

View File

@ -1,23 +0,0 @@
module Rex
module Exploitation
autoload :Seh, 'rex/exploitation/seh'
autoload :OpcodeDb, 'rex/exploitation/opcodedb'
# CMD stagers
autoload :CmdStagerBase, 'rex/exploitation/cmdstager/base'
autoload :CmdStagerDebugAsm, 'rex/exploitation/cmdstager/debug_asm'
autoload :CmdStagerDebugWrite, 'rex/exploitation/cmdstager/debug_write'
autoload :CmdStagerTFTP, 'rex/exploitation/cmdstager/tftp'
autoload :CmdStagerVBS, 'rex/exploitation/cmdstager/vbs'
# Shellcode slicing
autoload :Egghunter, 'rex/exploitation/egghunter'
autoload :Omelet, 'rex/exploitation/omelet'
# Javascript fun
autoload :EncryptJS, 'rex/exploitation/encryptjs'
autoload :HeapLib, 'rex/exploitation/heaplib'
autoload :ObfuscateJS, 'rex/exploitation/obfuscatejs'
autoload :JavascriptOSDetect, 'rex/exploitation/javascriptosdetect'
end
end

View File

@ -1,6 +1,6 @@
## require 'rex/text'
# $Id$ require 'rex/arch'
## require 'msf/core/framework'
module Rex module Rex
module Exploitation module Exploitation

View File

@ -1,7 +1,11 @@
## ##
# $Id$ # $Id: debug_asm.rb 12595 2011-05-12 18:33:49Z jduck $
## ##
require 'rex/text'
require 'rex/arch'
require 'msf/core/framework'
module Rex module Rex
module Exploitation module Exploitation

View File

@ -1,7 +1,11 @@
## ##
# $Id$ # $Id: debug_write.rb 12595 2011-05-12 18:33:49Z jduck $
## ##
require 'rex/text'
require 'rex/arch'
require 'msf/core/framework'
module Rex module Rex
module Exploitation module Exploitation

View File

@ -2,6 +2,10 @@
# $Id$ # $Id$
## ##
require 'rex/text'
require 'rex/arch'
require 'msf/core/framework'
module Rex module Rex
module Exploitation module Exploitation

View File

@ -1,7 +1,11 @@
## ##
# $Id$ # $Id: vbs.rb 12595 2011-05-12 18:33:49Z jduck $
## ##
require 'rex/text'
require 'rex/arch'
require 'msf/core/framework'
module Rex module Rex
module Exploitation module Exploitation

View File

@ -103,8 +103,12 @@ class Omelet
nr_eggs_hex = "%02x" % nr_eggs nr_eggs_hex = "%02x" % nr_eggs
eggsize_hex = "%02x" % eggsize eggsize_hex = "%02x" % eggsize
hextag = eggtag.unpack('C*').map { |b| "%02x" % b }.join hextag = ''
hextag << "01" eggtag.each_byte do |thischar|
decchar = "%02x" % thischar
hextag = decchar + hextag
end
hextag = hextag + "01"
# search forward or backward ? # search forward or backward ?
setflag = nil setflag = nil

View File

@ -1,16 +0,0 @@
##
# $Id$
#
# This file simply provides an autoload interface for the children
# of Rex::IO
#
##
module Rex::IO
autoload :Stream, 'rex/io/stream'
autoload :StreamAbstraction, 'rex/io/stream_abstraction'
autoload :StreamServer, 'rex/io/stream_server'
autoload :BidirectionalPipe, 'rex/io/bidirectional_pipe'
autoload :DatagramAbstraction, 'rex/io/datagram_abstraction'
autoload :RingBuffer, 'rex/io/ring_buffer'
end

View File

@ -1,17 +1,4 @@
## #!/usr/bin/env ruby
# $Id: $
#
# maps autoload for logging classes
##
require 'rex/constants' # for LEV_'s require 'rex/constants' # for LEV_'s
module Rex
module Logging
autoload :LogSink, 'rex/logging/log_sink'
autoload :Sinks, 'rex/logging/sinks'
end
end
# This defines a global so it must be loaded always
require 'rex/logging/log_dispatcher' require 'rex/logging/log_dispatcher'

View File

@ -1,4 +1,5 @@
require 'rex/sync' require 'rex/sync'
require 'rex/logging/log_sink'
module Rex module Rex
module Logging module Logging

View File

@ -37,3 +37,6 @@ end
end end
end end
require 'rex/logging/sinks/flatfile'
require 'rex/logging/sinks/stderr'

View File

@ -1,16 +0,0 @@
##
# $Id$
#
# Map log sinks for autload
##
module Rex
module Logging
module Sinks
autoload :Flatfile, 'rex/logging/sinks/flatfile'
autoload :Stderr, 'rex/logging/sinks/stderr'
end
end
end

View File

@ -1,5 +1,3 @@
require 'rex/logging'
module Rex module Rex
module Logging module Logging
module Sinks module Sinks

View File

@ -1,23 +0,0 @@
##
# $Id$
#
# This file maps parsers for autoload
##
module Rex
module Parser
# General parsers
autoload :Arguments, 'rex/parser/arguments'
autoload :Ini, 'rex/parser/ini'
# Data import parsers
autoload :NmapXMLStreamParser, 'rex/parser/nmap_xml'
autoload :NexposeXMLStreamParser, 'rex/parser/nexpose_xml'
autoload :RetinaXMLStreamParser, 'rex/parser/retina_xml'
autoload :NetSparkerXMLStreamParser, 'rex/parser/netsparker_xml'
autoload :NessusXMLStreamParser, 'rex/parser/nessus_xml'
autoload :IP360XMLStreamParser, 'rex/parser/ip360_xml'
autoload :IP360ASPLXMLStreamParser, 'rex/parser/ip360_aspl_xml'
autoload :AppleBackupManifestDB, 'rex/parser/apple_backup_manifestdb'
end
end

View File

@ -59,8 +59,7 @@ class NmapXMLStreamParser
end end
def reset_state def reset_state
@host = { "status" => nil, "addrs" => {}, "ports" => [], "scripts" => {} } @host = { "status" => nil, "addrs" => {}, "ports" => [] }
@state = nil
end end
def tag_start(name, attributes) def tag_start(name, attributes)
@ -99,7 +98,6 @@ class NmapXMLStreamParser
@host["status_reason"] = attributes["reason"] @host["status_reason"] = attributes["reason"]
when "port" when "port"
@host["ports"].push(attributes) @host["ports"].push(attributes)
@state = :in_port_tag
when "state" when "state"
# <state> refers to the state of a port; values are "open", "closed", or "filtered" # <state> refers to the state of a port; values are "open", "closed", or "filtered"
@host["ports"].last["state"] = attributes["state"] @host["ports"].last["state"] = attributes["state"]
@ -108,21 +106,8 @@ class NmapXMLStreamParser
# be any collisions on attribute names here, so just merge them. # be any collisions on attribute names here, so just merge them.
@host["ports"].last.merge!(attributes) @host["ports"].last.merge!(attributes)
when "script" when "script"
# Associate scripts under a port tag with the appropriate port.
# Other scripts from <hostscript> tags can only be associated with
# the host and scripts from <postscript> tags don't really belong
# to anything, so ignore them
if @state == :in_port_tag
@host["ports"].last["scripts"] ||= {} @host["ports"].last["scripts"] ||= {}
@host["ports"].last["scripts"][attributes["id"]] = attributes["output"] @host["ports"].last["scripts"][attributes["id"]] = attributes["output"]
elsif @host
@host["scripts"] ||= {}
@host["scripts"][attributes["id"]] = attributes["output"]
else
# post scripts are used for things like comparing all the found
# ssh keys to see if multiple hosts have the same key
# fingerprint. Ignore them.
end
when "trace" when "trace"
@host["trace"] = {"port" => attributes["port"], "proto" => attributes["proto"], "hops" => [] } @host["trace"] = {"port" => attributes["port"], "proto" => attributes["proto"], "hops" => [] }
when "hop" when "hop"
@ -134,8 +119,6 @@ class NmapXMLStreamParser
def tag_end(name) def tag_end(name)
case name case name
when "port"
@state = nil
when "host" when "host"
on_found_host.call(@host) if on_found_host on_found_host.call(@host) if on_found_host
reset_state reset_state

View File

@ -1,3 +1 @@
module Rex::Payloads require 'rex/payloads/win32'
autoload :Win32, 'rex/payloads/win32'
end

View File

@ -1,4 +1,2 @@
module Rex::Payloads::Win32 require 'rex/payloads/win32/common'
autoload :Common, 'rex/payloads/win32/common' require 'rex/payloads/win32/kernel'
autoload :Kernel, 'rex/payloads/win32/kernel'
end

View File

@ -1,12 +1,13 @@
module Rex module Rex
module Payloads module Payloads
module Win32 module Win32
module Kernel
autoload :Common, 'rex/payloads/win32/kernel/common' require 'rex/payloads/win32/kernel/common'
autoload :Recovery, 'rex/payloads/win32/kernel/recovery' require 'rex/payloads/win32/kernel/recovery'
autoload :Stager, 'rex/payloads/win32/kernel/stager' require 'rex/payloads/win32/kernel/stager'
autoload :Migration, 'rex/payloads/win32/kernel/migration' require 'rex/payloads/win32/kernel/migration'
module Kernel
# #
# Constructs a kernel-mode payload using the supplied options. The options # Constructs a kernel-mode payload using the supplied options. The options

View File

@ -1,11 +1,12 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# $Id$ # $Id$
#
module Rex module Rex
module PeParsey module PeParsey
autoload :Pe, 'rex/peparsey/pe'
autoload :PeMemDump, 'rex/peparsey/pe_memdump'
end end
end end
require 'rex/peparsey/pe'
require 'rex/peparsey/pe_memdump'

View File

@ -1,12 +1,13 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# $Id$ # $Id$
#
module Rex module Rex
module PeScan module PeScan
autoload :Analyze, 'rex/pescan/analyze'
autoload :Scanner, 'rex/pescan/scanner'
autoload :Search, 'rex/pescan/search'
end end
end end
require 'rex/pescan/analyze'
require 'rex/pescan/scanner'
require 'rex/pescan/search'

View File

@ -1,11 +1 @@
## require 'rex/platforms/windows'
# $Id: $
#
# This file maps Platforms for autoload
##
module Rex
module Platforms
autoload :Windows, 'rex/platforms/windows'
end
end

View File

@ -1,14 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# General independent containers # General independent containers
require 'rex/post/dir'
require 'rex/post/file'
require 'rex/post/file_stat'
require 'rex/post/io'
require 'rex/post/permission' require 'rex/post/permission'
require 'rex/post/process'
require 'rex/post/thread'
# Post-exploitation clients # Post-exploitation clients
require 'rex/post/dispatch_ninja'
require 'rex/post/meterpreter' require 'rex/post/meterpreter'

13
lib/rex/post/gen.pl Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/perl
use strict;
foreach my $f ('atime', 'blockdev?', 'chardev?', 'ctime', 'directory?',
'executable?', 'executable_real?', 'file?', 'ftype', 'grpowned?',
'mtime', 'owned?', 'pipe?', 'readable?', 'readable_real?', 'setuid?',
'setgid?', 'size', 'socket?', 'sticky?', 'symlink?', 'writeable?',
'writeable_real?', 'zero?') {
my $t = "\t";
print "${t}def File.$f(name)\n\t${t}stat(name).$f\n${t}end\n";
}

View File

@ -1,23 +1,12 @@
## require 'rex/proto/http'
# $Id$ require 'rex/proto/smb'
# require 'rex/proto/ntlm'
# This file maps Proto items for autoload require 'rex/proto/dcerpc'
## require 'rex/proto/drda'
module Rex module Rex
module Proto module Proto
autoload :Http, 'rex/proto/http'
autoload :SMB, 'rex/proto/smb'
autoload :NTLM, 'rex/proto/ntlm'
autoload :DCERPC, 'rex/proto/dcerpc'
autoload :DRDA, 'rex/proto/drda'
autoload :SunRPC, 'rex/proto/sunrpc'
autoload :DHCP, 'rex/proto/dhcp'
autoload :TFTP, 'rex/proto/tftp'
autoload :RFB, 'rex/proto/rfb'
attr_accessor :alias attr_accessor :alias
end end

View File

@ -1,15 +1,6 @@
module Rex require 'rex/proto/dcerpc/uuid'
module Proto require 'rex/proto/dcerpc/response'
module DCERPC require 'rex/proto/dcerpc/client'
require 'rex/proto/dcerpc/packet'
autoload :Exceptions, 'rex/proto/dcerpc/exceptions' require 'rex/proto/dcerpc/handle'
autoload :UUID, 'rex/proto/dcerpc/uuid' require 'rex/proto/dcerpc/ndr'
autoload :Response, 'rex/proto/dcerpc/response'
autoload :Client, 'rex/proto/dcerpc/client'
autoload :Packet, 'rex/proto/dcerpc/packet'
autoload :Handle, 'rex/proto/dcerpc/handle'
autoload :NDR, 'rex/proto/dcerpc/ndr'
end
end
end

View File

@ -1,10 +1,5 @@
module Rex require 'rex/proto/drda/constants'
module Proto
module DRDA
autoload :Constants, 'rex/proto/drda/constants'
autoload :Utils, 'rex/proto/drda/utils'
end
end
end
require 'rex/proto/drda/packet' require 'rex/proto/drda/packet'
require 'rex/proto/drda/utils'

View File

@ -1,18 +1,5 @@
# These are required by all uses of Rex::Proto::Http
require 'rex/proto/http/packet' require 'rex/proto/http/packet'
require 'rex/proto/http/request' require 'rex/proto/http/request'
require 'rex/proto/http/response' require 'rex/proto/http/response'
require 'rex/proto/http/client'
# These are specific to use case require 'rex/proto/http/server'
module Rex
module Proto
module Http
autoload :Client, 'rex/proto/http/client'
autoload :Server, 'rex/proto/http/server'
autoload :Handler, 'rex/proto/http/handler'
end
end
end

View File

@ -1,5 +1,4 @@
require 'rex/proto/http' require 'rex/proto/http'
require 'rex/text'
module Rex module Rex
module Proto module Proto

View File

@ -1,13 +1,7 @@
module Rex require 'rex/proto/ntlm/constants'
module Proto require 'rex/proto/ntlm/exceptions'
module NTLM require 'rex/proto/ntlm/crypt'
autoload :Constants, 'rex/proto/ntlm/constants' require 'rex/proto/ntlm/utils'
autoload :Exceptions, 'rex/proto/ntlm/exceptions' require 'rex/proto/ntlm/base'
require 'rex/proto/ntlm/message'
autoload :Base, 'rex/proto/ntlm/base'
autoload :Crypt, 'rex/proto/ntlm/crypt'
autoload :Message, 'rex/proto/ntlm/message'
autoload :Utils, 'rex/proto/ntlm/utils'
end
end
end

View File

@ -45,8 +45,6 @@
#this module defines the message class , useful for easily handling type 1/2/3 ntlm messages #this module defines the message class , useful for easily handling type 1/2/3 ntlm messages
require 'rex/text'
require 'rex/proto/ntlm/base' require 'rex/proto/ntlm/base'
require 'rex/proto/ntlm/constants' require 'rex/proto/ntlm/constants'
require 'rex/proto/ntlm/crypt' require 'rex/proto/ntlm/crypt'

View File

@ -1,15 +1,7 @@
module Rex require 'rex/proto/smb/constants'
module Proto require 'rex/proto/smb/exceptions'
module SMB require 'rex/proto/smb/evasions'
require 'rex/proto/smb/crypt'
autoload :Constants, 'rex/proto/smb/constants' require 'rex/proto/smb/utils'
autoload :Exceptions, 'rex/proto/smb/exceptions' require 'rex/proto/smb/client'
autoload :Evasions, 'rex/proto/smb/evasions' require 'rex/proto/smb/simpleclient'
autoload :Crypt, 'rex/proto/smb/crypt'
autoload :Utils, 'rex/proto/smb/utils'
autoload :Client, 'rex/proto/smb/client'
autoload :SimpleClient, 'rex/proto/smb/simpleclient'
end
end
end

View File

@ -1,5 +1,6 @@
require 'singleton' require 'singleton'
require 'rex' require 'rex'
require 'rex/service'
module Rex module Rex

View File

@ -12,23 +12,19 @@ module Rex
### ###
module Socket module Socket
# Plumbing / Aux module Comm
autoload :Parameters, 'rex/socket/parameters' end
autoload :Comm, 'rex/socket/comm'
# Underlying protocol-specific require 'rex/socket/parameters'
autoload :Ip, 'rex/socket/ip' require 'rex/socket/tcp'
autoload :Udp, 'rex/socket/udp' require 'rex/socket/tcp_server'
autoload :Tcp, 'rex/socket/tcp'
autoload :TcpServer, 'rex/socket/tcp_server'
autoload :SslTcp, 'rex/socket/ssl_tcp'
autoload :SslTcpServer, 'rex/socket/ssl_tcp_server'
# Utilities require 'rex/socket/comm'
autoload :SwitchBoard, 'rex/socket/switch_board' require 'rex/socket/comm/local'
autoload :SubnetWalker, 'rex/socket/subnet_walker'
autoload :Range, 'rex/socket/range_walker' require 'rex/socket/switch_board'
autoload :RangeWalker, 'rex/socket/range_walker' require 'rex/socket/subnet_walker'
require 'rex/socket/range_walker'
## ##
# #

View File

@ -14,8 +14,6 @@ module Socket
### ###
module Comm module Comm
autoload :Local, 'rex/socket/comm/local'
### ###
# #
# This mixin provides stubs for event notification handlers that can be # This mixin provides stubs for event notification handlers that can be

View File

@ -1,6 +1,10 @@
require 'rex/compat'
require 'rex/socket'
require 'singleton' require 'singleton'
require 'rex/socket'
require 'rex/socket/tcp'
require 'rex/socket/ssl_tcp'
require 'rex/socket/ssl_tcp_server'
require 'rex/socket/udp'
require 'rex/socket/ip'
require 'timeout' require 'timeout'
### ###

View File

@ -1,6 +1,6 @@
module Rex #!/usr/bin/env ruby
autoload :ReadWriteLock, 'rex/sync/read_write_lock'
autoload :ThreadSafe, 'rex/sync/thread_safe' require 'rex/sync/thread_safe'
autoload :Ref, 'rex/sync/ref' require 'rex/sync/ref'
autoload :Sync, 'rex/sync/event' require 'rex/sync/read_write_lock'
end require 'rex/sync/event'

Some files were not shown because too many files have changed in this diff Show More