Redis: Store the major, minor, and patchlevel as ints as well as the whole version as a string
This commit is contained in:
parent
7c651c0be5
commit
67fbf1facb
@ -89,6 +89,15 @@ type Result struct {
|
|||||||
// present.
|
// present.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
|
|
||||||
|
// Major is the version's major number.
|
||||||
|
Major uint32 `json:"major,omitempty"`
|
||||||
|
|
||||||
|
// Minor is the version's minor number.
|
||||||
|
Minor uint32 `json:"minor,omitempty"`
|
||||||
|
|
||||||
|
// Patchlevel is the version's patchlevel number.
|
||||||
|
Patchlevel uint32 `json:"patchlevel,omitempty"`
|
||||||
|
|
||||||
// OS is read from the InfoResponse (the field "os"), if present. It specifies
|
// OS is read from the InfoResponse (the field "os"), if present. It specifies
|
||||||
// the OS the redis server is running.
|
// the OS the redis server is running.
|
||||||
OS string `json:"os,omitempty"`
|
OS string `json:"os,omitempty"`
|
||||||
@ -403,6 +412,16 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter
|
|||||||
switch prefix {
|
switch prefix {
|
||||||
case "redis_version":
|
case "redis_version":
|
||||||
result.Version = suffix
|
result.Version = suffix
|
||||||
|
versionSegments := strings.SplitN(suffix, ".", 3)
|
||||||
|
if len(versionSegments) > 0 {
|
||||||
|
result.Major = convToUint32(versionSegments[0])
|
||||||
|
}
|
||||||
|
if len(versionSegments) > 1 {
|
||||||
|
result.Minor = convToUint32(versionSegments[1])
|
||||||
|
}
|
||||||
|
if len(versionSegments) > 2 {
|
||||||
|
result.Patchlevel = convToUint32(versionSegments[2])
|
||||||
|
}
|
||||||
case "os":
|
case "os":
|
||||||
result.OS = suffix
|
result.OS = suffix
|
||||||
case "arch_bits":
|
case "arch_bits":
|
||||||
|
@ -25,6 +25,9 @@ redis_scan_response = SubRecord({
|
|||||||
]),
|
]),
|
||||||
"quit_response": String(doc="The response to the QUIT command.", examples=["OK"]),
|
"quit_response": String(doc="The response to the QUIT command.", examples=["OK"]),
|
||||||
"version": String(doc="The version string, read from the the info_response (if available)."),
|
"version": String(doc="The version string, read from the the info_response (if available)."),
|
||||||
|
"major": Unsigned32BitInteger(doc="Major is the version's major number."),
|
||||||
|
"minor": Unsigned32BitInteger(doc="Minor is the version's minor number."),
|
||||||
|
"patchlevel": Unsigned32BitInteger(doc="Patchlevel is the version's patchlevel number."),
|
||||||
"os": String(doc="The OS the Redis server is running, read from the the info_response (if available)."),
|
"os": String(doc="The OS the Redis server is running, read from the the info_response (if available)."),
|
||||||
"mode": String(doc="The mode the Redis server is running (standalone or cluster), read from the the info_response (if available)."),
|
"mode": String(doc="The mode the Redis server is running (standalone or cluster), read from the the info_response (if available)."),
|
||||||
"git_sha1": String(doc="The Sha-1 Git commit hash the Redis server used."),
|
"git_sha1": String(doc="The Sha-1 Git commit hash the Redis server used."),
|
||||||
|
Loading…
Reference in New Issue
Block a user