Skip to content

Commit

Permalink
Use zeitwerk for lib/msf/core folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 committed Dec 7, 2020
1 parent d785271 commit 1617b3e
Show file tree
Hide file tree
Showing 1,299 changed files with 905 additions and 3,083 deletions.
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ PATH
windows_error
xdr
xmlrpc
zeitwerk

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -439,6 +440,7 @@ GEM
activesupport (>= 4.2, < 7.0)
xmlrpc (0.3.1)
yard (0.9.25)
zeitwerk (2.4.0)

PLATFORMS
ruby
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env rake
require File.expand_path('../config/application', __FILE__)
require 'msfenv'
require 'metasploit/framework/require'
require 'metasploit/framework/spec/untested_payloads'

Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

require 'metasploit/framework/common_engine'
require 'metasploit/framework/database'

module Metasploit
module Framework
class Application < Rails::Application
Expand All @@ -52,3 +51,4 @@ class Application < Rails::Application

# Silence warnings about this defaulting to true
I18n.enforce_available_locales = true
require 'msfenv'
1 change: 0 additions & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Metasploit::Framework::Application.initialize!
3 changes: 1 addition & 2 deletions lib/metasploit/framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
require 'rkelly'
require 'robots'
require 'zip'

require 'msf'
#
# Project
#

require 'msf/core'

# Top-level namespace that is shared between {Metasploit::Framework
# metasploit-framework} and pro, which uses Metasploit::Pro.
Expand Down
3 changes: 0 additions & 3 deletions lib/metasploit/framework/afp/client.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: binary -*-
require 'msf/core'
require 'msf/core/exploit/tcp'

module Metasploit
module Framework
module AFP
Expand Down
6 changes: 4 additions & 2 deletions lib/metasploit/framework/common_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

require 'metasploit/model/engine'
require 'metasploit/concern/engine'
require 'metasploit/framework/require'
require 'msf/base/config'
Metasploit::Framework::Require.optionally_require_metasploit_db_gem_engines

# `Rails::Engine` behavior common to both {Metasploit::Framework::Application} and {Metasploit::Framework::Engine}.
Expand All @@ -27,8 +29,8 @@ module Metasploit::Framework::CommonEngine
# @see http://rubydoc.info/stdlib/core/IO:read
config.before_initialize do
encoding = 'binary'
Encoding.default_external = encoding
Encoding.default_internal = encoding
::Encoding.default_external = encoding
::Encoding.default_internal = encoding
end

config.root = Msf::Config::install_root
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/framework/spec/constants.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'msf/core/modules'

# Monitor constants created by module loading to ensure that the loads in one example don't interfere with the
# assertions in another example.
Expand Down
1 change: 1 addition & 0 deletions lib/metasploit/framework/thread_factory_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# # framework.threads created here
# Rex::ThreadFactory.spawn("name", false) { ... }
#
require 'metasploit_data_models'
class Metasploit::Framework::ThreadFactoryProvider < Metasploit::Model::Base
#
# Attributes
Expand Down
3 changes: 0 additions & 3 deletions lib/metasploit/framework/varnish/client.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: binary -*-
require 'msf/core'
require 'msf/core/exploit/tcp'

module Metasploit
module Framework
module Varnish
Expand Down
5 changes: 5 additions & 0 deletions lib/msf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Msf

end
require 'msf/core/exception' # TODO: temporary require until we can split up the exceptions file and namespace properly
require 'msf_autoload'
1 change: 0 additions & 1 deletion lib/msf/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# such as exploitation, into easier to manage functions.

# framework-base depends on framework-core
require 'msf/core'

# Configuration
require 'msf/base/config'
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/base/logging.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: binary -*-
require 'rex'
require 'msf/base'

require 'msf/core'
module Msf

# This module provides an initialization interface for logging.
Expand Down
1 change: 0 additions & 1 deletion lib/msf/base/serializer/readable_text.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: binary -*-

require 'msf/core/opt_condition'

module Msf
module Serializer
Expand Down
1 change: 0 additions & 1 deletion lib/msf/base/sessions/encrypted_shell.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: binary -*-
require 'msf/base'
require 'securerandom'
require 'msf/core/payload/windows/payload_db_conf'

module Msf
module Sessions
Expand Down
2 changes: 0 additions & 2 deletions lib/msf/base/sessions/mettle_config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: binary -*-

require 'msf/core/payload/transport_config'
require 'msf/core/payload/uuid/options'
require 'base64'
require 'securerandom'

Expand Down
2 changes: 1 addition & 1 deletion lib/msf/base/simple/framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'msf/base/simple'
require 'msf/base/simple/framework/module_paths'
require 'msf/base/simple/noop_job_listener'

require 'msf/core/constants'
module Msf
module Simple

Expand Down
1 change: 1 addition & 0 deletions lib/msf/base/simple/framework/module_paths.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: binary -*-
require 'rails'
module Msf
module Simple
module Framework
Expand Down
41 changes: 0 additions & 41 deletions lib/msf/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,5 @@ module Msf
LogSource = "core"
end

# General
require 'msf/core/constants'
require 'msf/core/exceptions'
require 'msf/core/data_store'
require 'msf/core/option_container'

# Event subscriber interfaces
require 'msf/events'

# Framework context and core classes
require 'msf/core/framework'
require 'msf/core/feature_manager'
require 'msf/core/db_manager'
require 'msf/core/event_dispatcher'
require 'msf/core/module_manager'
require 'msf/core/module_set'
require 'msf/core/plugin_manager'
require 'msf/core/session'
require 'msf/core/session_manager'
require 'msf/core/analyze'



# Wrappers
require 'msf/core/encoded_payload'

# Pseudo-modules
require 'msf/core/handler'

# Modules
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'
require 'msf/core/evasion'

# Drivers
require 'msf/core/exploit_driver'
require 'msf/core/evasion_driver'

1 change: 0 additions & 1 deletion lib/msf/core/author.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: binary -*-
require 'msf/core'

###
#
Expand Down
2 changes: 0 additions & 2 deletions lib/msf/core/auxiliary.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: binary -*-
require 'msf/core/module'

module Msf

Expand All @@ -19,7 +18,6 @@ class Complete < RuntimeError
class Failed < RuntimeError
end

require 'msf/core/auxiliary/mixins'

include HasActions

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion lib/msf/core/auxiliary/etcd.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: binary -*-

require 'msf/core/exploit'

module Msf
module Auxiliary::Etcd
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion lib/msf/core/auxiliary/llmnr.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: binary -*-
require 'msf/core/auxiliary/mdns'

module Msf
# This module provides methods for working with LLMNR
Expand Down
51 changes: 0 additions & 51 deletions lib/msf/core/auxiliary/mixins.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/msf/core/auxiliary/mqtt.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: binary -*-

require 'msf/core/exploit'
require 'rex/proto/mqtt'

module Msf
Expand Down
1 change: 0 additions & 1 deletion lib/msf/core/auxiliary/ntp.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: binary -*-
require 'rex/proto/ntp'
require 'msf/core/exploit'
module Msf

###
Expand Down
1 change: 0 additions & 1 deletion lib/msf/core/auxiliary/redis.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: binary -*-
require 'msf/core/exploit'
module Msf
###
#
Expand Down
6 changes: 0 additions & 6 deletions lib/msf/core/auxiliary/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ module Auxiliary::Web
module Analysis
end

require 'msf/core/auxiliary/web/http'
require 'msf/core/auxiliary/web/fuzzable'
require 'msf/core/auxiliary/web/form'
require 'msf/core/auxiliary/web/path'
require 'msf/core/auxiliary/web/target'

include Auxiliary::Report

attr_reader :target
Expand Down
15 changes: 15 additions & 0 deletions lib/msf/core/auxiliary/wmap_crawler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Msf
###
#
# This module provides methods for WMAP Crawler modules
#
###

module Auxiliary::WmapCrawler
include Auxiliary::WmapModule

def wmap_type
:wmap_crawler
end
end
end
Loading

0 comments on commit 1617b3e

Please sign in to comment.