Scan a Website for Malicious Content and Threats in Go

Cloudmersive
2 min readMar 7, 2022

We get bad URL’s in our inboxes and through social media platforms all the time these days. It’s about time to make identifying them easier. Make use of the website scanning iteration of our Virus Scan API to quickly identify if the URL contains malicious content or threats (including Phishing attempts). Take advantage of ready-to-run code below in Go, or visit the Cloudmersive API Console to find the programming language of your choice.

First things first, though — head to www.cloudmersive.com and create a free account to receive an API key (if you don’t already have one). This account will provide 800 monthly API calls with zero financial commitments and access to all the APIs in our catalogue.

Copy the below code examples:

package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {url := "https://api.cloudmersive.com/virus/scan/website"
method := "POST"
payload := strings.NewReader("Url=%3Cstring%3E")client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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))
}

After that, you’re all set to scan.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.