Skip to content

Commit 3dfdaea

Browse files
committed
(re)fix spip mixin
1 parent 9907f94 commit 3dfdaea

File tree

1 file changed

+6
-9
lines changed
  • lib/msf/core/exploit/remote/http

1 file changed

+6
-9
lines changed

lib/msf/core/exploit/remote/http/spip.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,15 @@ def spip_plugin_version(plugin_name)
5252

5353
composed_by = res.headers['Composed-By']
5454
# 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
5657

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')
6260
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
6462

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
6764
end
6865

6966
# Parse the plugin version from config.txt or composed-by

0 commit comments

Comments
 (0)