Redis: Made check so that if line_prefix_suffix only contains prefix, adds empty string to suffix index
This commit is contained in:
parent
d6059c655d
commit
bcaf844200
@ -339,7 +339,6 @@ func (s *Scanner) Protocol() string {
|
|||||||
func convToUint32(s string) uint32 {
|
func convToUint32(s string) uint32 {
|
||||||
s_64, err := strconv.ParseUint(s, 10, 32)
|
s_64, err := strconv.ParseUint(s, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: LEARN HOW TO LOG
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return uint32(s_64)
|
return uint32(s_64)
|
||||||
@ -387,7 +386,11 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter
|
|||||||
fieldsWeAreLookingFor := 12
|
fieldsWeAreLookingFor := 12
|
||||||
fieldsFound := 0
|
fieldsFound := 0
|
||||||
for _, line := range strings.Split(string(infoResponseBulk), "\r\n") {
|
for _, line := range strings.Split(string(infoResponseBulk), "\r\n") {
|
||||||
switch line_prefix_suffix := strings.SplitN(line, ":", 2); line_prefix_suffix[0] {
|
line_prefix_suffix := strings.SplitN(line, ":", 2)
|
||||||
|
if len(line_prefix_suffix) == 1 {
|
||||||
|
line_prefix_suffix = append(line_prefix_suffix, "")
|
||||||
|
}
|
||||||
|
switch line_prefix_suffix[0] {
|
||||||
case "redis_version":
|
case "redis_version":
|
||||||
fieldsFound += 1
|
fieldsFound += 1
|
||||||
result.Version = line_prefix_suffix[1]
|
result.Version = line_prefix_suffix[1]
|
||||||
|
@ -27,7 +27,7 @@ redis_scan_response = SubRecord({
|
|||||||
"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)."),
|
||||||
"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 Git Sha 1 the redis server used."),
|
"git_sha1": String(doc="The Sha-1 Git commit hash the redis server used."),
|
||||||
"build_id": String(doc="The Build ID of the redis server."),
|
"build_id": String(doc="The Build ID of the redis server."),
|
||||||
"arch_bits": String(doc="The architecture bits (32 or 64) the redis server used to build."),
|
"arch_bits": String(doc="The architecture bits (32 or 64) the redis server used to build."),
|
||||||
"gcc_version": String(doc="The version of the GCC compiler used to compile the Redis server."),
|
"gcc_version": String(doc="The version of the GCC compiler used to compile the Redis server."),
|
||||||
|
Loading…
Reference in New Issue
Block a user