Redis: Made check so that if line_prefix_suffix only contains prefix, adds empty string to suffix index

This commit is contained in:
Ricky Diaz Gomez 2019-06-21 16:14:13 -04:00
parent d6059c655d
commit bcaf844200
2 changed files with 6 additions and 3 deletions

View File

@ -339,7 +339,6 @@ func (s *Scanner) Protocol() string {
func convToUint32(s string) uint32 {
s_64, err := strconv.ParseUint(s, 10, 32)
if err != nil {
// TODO: LEARN HOW TO LOG
return 0
}
return uint32(s_64)
@ -387,7 +386,11 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter
fieldsWeAreLookingFor := 12
fieldsFound := 0
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":
fieldsFound += 1
result.Version = line_prefix_suffix[1]

View File

@ -27,7 +27,7 @@ redis_scan_response = SubRecord({
"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)."),
"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."),
"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."),