How to Check if a URL is a High-Risk Path in Go
Did you know that you could be leaving your business open for attack by using a common access method called a server administration path? These paths are high-risk URLs that can be utilized in databases or applications to specify the set of directories that are accessed; the reason for the high-risk tag is these URLs contain information that can be easily switched around to gain remote access to confidential information. Instead of sifting through your access paths to search for these vulnerabilities, the following API can be used in Go to automatically check if URLs or relative paths are a server administration path.
To perform the operation, all you need to do is input the target URL/path and your API key into the below code:
package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)func main() {url := "https://api.cloudmersive.com/validate/domain/url/is-admin-path"
method := "POST"payload := strings.NewReader(`"<string>"`)client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Apikey", "YOUR-API-KEY-HERE")res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
If you need to obtain your API key, visit the Cloudmersive website to register for a free account; this will provide access to 800 monthly calls across our multitude of APIs.