forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b72f70c
commit dab5d66
Showing
3 changed files
with
97 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Msf | ||
class Exploit | ||
class Remote | ||
module HTTP | ||
module Magento | ||
def initialize(info = {}) | ||
super | ||
end | ||
|
||
# Extracts the Magento version information from the /magento_version page | ||
# | ||
# @return [Hash] Containing the keys 'version' and 'edition' | ||
def magento_version | ||
vprint_status('Trying to get the Magento version') | ||
|
||
# request to check if the target is vulnerable /magento_version | ||
res = send_request_cgi({ | ||
'method' => 'GET', | ||
'uri' => normalize_uri(target_uri.path, '/magento_version') | ||
}) | ||
|
||
return unless res&.code == 200 | ||
|
||
# Magento/2.4 (Community) | ||
version, edition = res.body.scan(%r{Magento/([\d.]+) \(([^)]+)\)}).first | ||
|
||
version = Rex::Version.new(version) | ||
|
||
{ 'version' => version, 'edition' => edition } | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters