Skip to content

Commit 1617b3e

Browse files
committed
Use zeitwerk for lib/msf/core folder
1 parent d785271 commit 1617b3e

File tree

1,299 files changed

+905
-3083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,299 files changed

+905
-3083
lines changed

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ PATH
8484
windows_error
8585
xdr
8686
xmlrpc
87+
zeitwerk
8788

8889
GEM
8990
remote: https://rubygems.org/
@@ -439,6 +440,7 @@ GEM
439440
activesupport (>= 4.2, < 7.0)
440441
xmlrpc (0.3.1)
441442
yard (0.9.25)
443+
zeitwerk (2.4.0)
442444

443445
PLATFORMS
444446
ruby

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env rake
22
require File.expand_path('../config/application', __FILE__)
3+
require 'msfenv'
34
require 'metasploit/framework/require'
45
require 'metasploit/framework/spec/untested_payloads'
56

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
require 'metasploit/framework/common_engine'
3131
require 'metasploit/framework/database'
32-
3332
module Metasploit
3433
module Framework
3534
class Application < Rails::Application
@@ -52,3 +51,4 @@ class Application < Rails::Application
5251

5352
# Silence warnings about this defaulting to true
5453
I18n.enforce_available_locales = true
54+
require 'msfenv'

config/environment.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Load the rails application
22
require File.expand_path('../application', __FILE__)
3-
43
# Initialize the rails application
54
Metasploit::Framework::Application.initialize!

lib/metasploit/framework.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
require 'rkelly'
1818
require 'robots'
1919
require 'zip'
20-
20+
require 'msf'
2121
#
2222
# Project
2323
#
2424

25-
require 'msf/core'
2625

2726
# Top-level namespace that is shared between {Metasploit::Framework
2827
# metasploit-framework} and pro, which uses Metasploit::Pro.

lib/metasploit/framework/afp/client.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core'
3-
require 'msf/core/exploit/tcp'
4-
52
module Metasploit
63
module Framework
74
module AFP

lib/metasploit/framework/common_engine.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
require 'metasploit/model/engine'
1212
require 'metasploit/concern/engine'
13+
require 'metasploit/framework/require'
14+
require 'msf/base/config'
1315
Metasploit::Framework::Require.optionally_require_metasploit_db_gem_engines
1416

1517
# `Rails::Engine` behavior common to both {Metasploit::Framework::Application} and {Metasploit::Framework::Engine}.
@@ -27,8 +29,8 @@ module Metasploit::Framework::CommonEngine
2729
# @see http://rubydoc.info/stdlib/core/IO:read
2830
config.before_initialize do
2931
encoding = 'binary'
30-
Encoding.default_external = encoding
31-
Encoding.default_internal = encoding
32+
::Encoding.default_external = encoding
33+
::Encoding.default_internal = encoding
3234
end
3335

3436
config.root = Msf::Config::install_root

lib/metasploit/framework/spec/constants.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'msf/core/modules'
21

32
# Monitor constants created by module loading to ensure that the loads in one example don't interfere with the
43
# assertions in another example.

lib/metasploit/framework/thread_factory_provider.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# # framework.threads created here
77
# Rex::ThreadFactory.spawn("name", false) { ... }
88
#
9+
require 'metasploit_data_models'
910
class Metasploit::Framework::ThreadFactoryProvider < Metasploit::Model::Base
1011
#
1112
# Attributes

lib/metasploit/framework/varnish/client.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core'
3-
require 'msf/core/exploit/tcp'
4-
52
module Metasploit
63
module Framework
74
module Varnish

lib/msf.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Msf
2+
3+
end
4+
require 'msf/core/exception' # TODO: temporary require until we can split up the exceptions file and namespace properly
5+
require 'msf_autoload'

lib/msf/base.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# such as exploitation, into easier to manage functions.
1515

1616
# framework-base depends on framework-core
17-
require 'msf/core'
1817

1918
# Configuration
2019
require 'msf/base/config'

lib/msf/base/logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: binary -*-
22
require 'rex'
33
require 'msf/base'
4-
4+
require 'msf/core'
55
module Msf
66

77
# This module provides an initialization interface for logging.

lib/msf/base/serializer/readable_text.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: binary -*-
22

3-
require 'msf/core/opt_condition'
43

54
module Msf
65
module Serializer

lib/msf/base/sessions/encrypted_shell.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: binary -*-
22
require 'msf/base'
33
require 'securerandom'
4-
require 'msf/core/payload/windows/payload_db_conf'
54

65
module Msf
76
module Sessions

lib/msf/base/sessions/mettle_config.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: binary -*-
22

3-
require 'msf/core/payload/transport_config'
4-
require 'msf/core/payload/uuid/options'
53
require 'base64'
64
require 'securerandom'
75

lib/msf/base/simple/framework.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'msf/base/simple'
33
require 'msf/base/simple/framework/module_paths'
44
require 'msf/base/simple/noop_job_listener'
5-
5+
require 'msf/core/constants'
66
module Msf
77
module Simple
88

lib/msf/base/simple/framework/module_paths.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: binary -*-
2+
require 'rails'
23
module Msf
34
module Simple
45
module Framework

lib/msf/core.rb

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,46 +30,5 @@ module Msf
3030
LogSource = "core"
3131
end
3232

33-
# General
34-
require 'msf/core/constants'
35-
require 'msf/core/exceptions'
36-
require 'msf/core/data_store'
37-
require 'msf/core/option_container'
38-
3933
# Event subscriber interfaces
4034
require 'msf/events'
41-
42-
# Framework context and core classes
43-
require 'msf/core/framework'
44-
require 'msf/core/feature_manager'
45-
require 'msf/core/db_manager'
46-
require 'msf/core/event_dispatcher'
47-
require 'msf/core/module_manager'
48-
require 'msf/core/module_set'
49-
require 'msf/core/plugin_manager'
50-
require 'msf/core/session'
51-
require 'msf/core/session_manager'
52-
require 'msf/core/analyze'
53-
54-
55-
56-
# Wrappers
57-
require 'msf/core/encoded_payload'
58-
59-
# Pseudo-modules
60-
require 'msf/core/handler'
61-
62-
# Modules
63-
require 'msf/core/module'
64-
require 'msf/core/encoder'
65-
require 'msf/core/auxiliary'
66-
require 'msf/core/exploit'
67-
require 'msf/core/nop'
68-
require 'msf/core/payload'
69-
require 'msf/core/post'
70-
require 'msf/core/evasion'
71-
72-
# Drivers
73-
require 'msf/core/exploit_driver'
74-
require 'msf/core/evasion_driver'
75-

lib/msf/core/author.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core'
32

43
###
54
#

lib/msf/core/auxiliary.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core/module'
32

43
module Msf
54

@@ -19,7 +18,6 @@ class Complete < RuntimeError
1918
class Failed < RuntimeError
2019
end
2120

22-
require 'msf/core/auxiliary/mixins'
2321

2422
include HasActions
2523

lib/msf/core/auxiliary/etcd.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: binary -*-
22

3-
require 'msf/core/exploit'
43

54
module Msf
65
module Auxiliary::Etcd

lib/msf/core/auxiliary/llmnr.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core/auxiliary/mdns'
32

43
module Msf
54
# This module provides methods for working with LLMNR

lib/msf/core/auxiliary/mixins.rb

Lines changed: 0 additions & 51 deletions
This file was deleted.

lib/msf/core/auxiliary/mqtt.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: binary -*-
22

3-
require 'msf/core/exploit'
43
require 'rex/proto/mqtt'
54

65
module Msf

lib/msf/core/auxiliary/ntp.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: binary -*-
22
require 'rex/proto/ntp'
3-
require 'msf/core/exploit'
43
module Msf
54

65
###

lib/msf/core/auxiliary/redis.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'msf/core/exploit'
32
module Msf
43
###
54
#

lib/msf/core/auxiliary/web.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ module Auxiliary::Web
1111
module Analysis
1212
end
1313

14-
require 'msf/core/auxiliary/web/http'
15-
require 'msf/core/auxiliary/web/fuzzable'
16-
require 'msf/core/auxiliary/web/form'
17-
require 'msf/core/auxiliary/web/path'
18-
require 'msf/core/auxiliary/web/target'
19-
2014
include Auxiliary::Report
2115

2216
attr_reader :target
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Msf
2+
###
3+
#
4+
# This module provides methods for WMAP Crawler modules
5+
#
6+
###
7+
8+
module Auxiliary::WmapCrawler
9+
include Auxiliary::WmapModule
10+
11+
def wmap_type
12+
:wmap_crawler
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)