diff --git a/modules/redis/scanner.go b/modules/redis/scanner.go index 17f6086..1071ca6 100644 --- a/modules/redis/scanner.go +++ b/modules/redis/scanner.go @@ -89,6 +89,15 @@ type Result struct { // present. 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 // the OS the redis server is running. OS string `json:"os,omitempty"` @@ -403,6 +412,16 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter switch prefix { case "redis_version": 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": result.OS = suffix case "arch_bits": diff --git a/zgrab2_schemas/zgrab2/redis.py b/zgrab2_schemas/zgrab2/redis.py index 8d411f4..d35ee1a 100644 --- a/zgrab2_schemas/zgrab2/redis.py +++ b/zgrab2_schemas/zgrab2/redis.py @@ -25,6 +25,9 @@ redis_scan_response = SubRecord({ ]), "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)."), + "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)."), "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."),