File tree Expand file tree Collapse file tree 5 files changed +19
-21
lines changed Expand file tree Collapse file tree 5 files changed +19
-21
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ module OptionalSession
11
11
# Validates options depending on whether we are using SESSION or an RHOST for our connection
12
12
def validate
13
13
super
14
- return unless framework . features . enabled? ( Msf :: FeatureManager :: SMB_SESSION_TYPE )
14
+ return unless optional_session_enabled?
15
15
16
16
# If the session is set use that by default regardless of rhost being (un)set
17
17
if session
@@ -23,6 +23,12 @@ def validate
23
23
end
24
24
end
25
25
26
+ def session
27
+ return nil unless optional_session_enabled?
28
+
29
+ super
30
+ end
31
+
26
32
protected
27
33
28
34
# Used to validate options when RHOST has been set
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize(info = {})
15
15
)
16
16
)
17
17
18
- if framework . features . enabled? ( Msf :: FeatureManager :: MSSQL_SESSION_TYPE )
18
+ if optional_session_enabled?
19
19
register_option_group ( name : 'SESSION' ,
20
20
description : 'Used when connecting via an existing SESSION' ,
21
21
option_names : [ 'SESSION' ] )
@@ -37,10 +37,8 @@ def initialize(info = {})
37
37
end
38
38
end
39
39
40
- def session
41
- return nil unless framework . features . enabled? ( Msf ::FeatureManager ::MSSQL_SESSION_TYPE )
42
-
43
- super
40
+ def optional_session_enabled?
41
+ framework . features . enabled? ( Msf ::FeatureManager ::MSSQL_SESSION_TYPE )
44
42
end
45
43
end
46
44
end
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize(info = {})
15
15
)
16
16
)
17
17
18
- if framework . features . enabled? ( Msf :: FeatureManager :: MYSQL_SESSION_TYPE )
18
+ if optional_session_enabled?
19
19
register_option_group ( name : 'SESSION' ,
20
20
description : 'Used when connecting via an existing SESSION' ,
21
21
option_names : [ 'SESSION' ] )
@@ -35,10 +35,8 @@ def initialize(info = {})
35
35
end
36
36
end
37
37
38
- def session
39
- return nil unless framework . features . enabled? ( Msf ::FeatureManager ::MYSQL_SESSION_TYPE )
40
-
41
- super
38
+ def optional_session_enabled?
39
+ framework . features . enabled? ( Msf ::FeatureManager ::MYSQL_SESSION_TYPE )
42
40
end
43
41
end
44
42
end
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize(info = {})
15
15
)
16
16
)
17
17
18
- if framework . features . enabled? ( Msf :: FeatureManager :: POSTGRESQL_SESSION_TYPE )
18
+ if optional_session_enabled?
19
19
register_option_group ( name : 'SESSION' ,
20
20
description : 'Used when connecting via an existing SESSION' ,
21
21
option_names : [ 'SESSION' ] )
@@ -37,10 +37,8 @@ def initialize(info = {})
37
37
end
38
38
end
39
39
40
- def session
41
- return nil unless framework . features . enabled? ( Msf ::FeatureManager ::POSTGRESQL_SESSION_TYPE )
42
-
43
- super
40
+ def optional_session_enabled?
41
+ framework . features . enabled? ( Msf ::FeatureManager ::POSTGRESQL_SESSION_TYPE )
44
42
end
45
43
end
46
44
end
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize(info = {})
15
15
)
16
16
)
17
17
18
- if framework . features . enabled? ( Msf :: FeatureManager :: SMB_SESSION_TYPE )
18
+ if optional_session_enabled?
19
19
register_option_group ( name : 'SESSION' ,
20
20
description : 'Used when connecting via an existing SESSION' ,
21
21
option_names : [ 'SESSION' ] )
@@ -35,10 +35,8 @@ def initialize(info = {})
35
35
end
36
36
end
37
37
38
- def session
39
- return nil unless framework . features . enabled? ( Msf ::FeatureManager ::SMB_SESSION_TYPE )
40
-
41
- super
38
+ def optional_session_enabled?
39
+ framework . features . enabled? ( Msf ::FeatureManager ::SMB_SESSION_TYPE )
42
40
end
43
41
end
44
42
end
You can’t perform that action at this time.
0 commit comments