File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
lib/msf/core/exploit/remote/http Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -52,18 +52,15 @@ def spip_plugin_version(plugin_name)
52
52
53
53
composed_by = res . headers [ 'Composed-By' ]
54
54
# Case 1: Check if 'Composed-By' header is present and not empty
55
- return parse_plugin_version ( composed_by , plugin_name ) if composed_by &.present?
55
+ version = composed_by &.present? ? parse_plugin_version ( composed_by , plugin_name ) : nil
56
+ return version if version
56
57
57
- composed_by =~ %r{(https?://[^\s ]+/local/config\. txt)}i
58
- config_url = ::Regexp . last_match ( 1 )
59
- config_url ||= normalize_uri ( target_uri . path , 'local' , 'config.txt' )
60
-
61
- # Case 2: Send a request to fetch the config.txt file
58
+ # Case 2: Extract URL from 'Composed-By' header and send a request to fetch the config.txt file
59
+ config_url = composed_by =~ %r{(https?://[^\s ]+/local/config\. txt)}i ? ::Regexp . last_match ( 1 ) : normalize_uri ( target_uri . path , 'local' , 'config.txt' )
62
60
config_res = send_request_cgi ( 'method' => 'GET' , 'uri' => config_url )
63
- return unless config_res &.code == 200
61
+ return parse_plugin_version ( config_res . body , plugin_name ) if config_res &.code == 200
64
62
65
- # Case 3: Parse the content of config.txt to find the plugin version
66
- parse_plugin_version ( config_res . body , plugin_name )
63
+ nil
67
64
end
68
65
69
66
# Parse the plugin version from config.txt or composed-by
You can’t perform that action at this time.
0 commit comments