Skip to content

Commit

Permalink
add Bingbot.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed May 24, 2024
1 parent 312a2ef commit 3101fae
Show file tree
Hide file tree
Showing 7 changed files with 385 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Provider data and search results can be cached to reduce API calls and improve p
| [Apple iCloud Private Relay](#Apple-iCloud-Private-Relay) | Anonymiser | - |
| [AWS](#Amazon-Web-Services) | Hosting Provider | - |
| [Azure](#Azure) | Hosting Provider | - |
| [Bingbot](#Bingbot) | Web crawler | - |
| [CriminalIP](#CriminalIP) | IP Reputation | Registration required |
| [DigitalOcean](#DigitalOcean) | Hosting Provider | - |
| [GCP](#Google-Cloud-Platform) | Hosting Provider | - |
Expand Down Expand Up @@ -135,6 +136,11 @@ used by their services.
that [publishes](https://www.microsoft.com/en-gb/download/details.aspx?id=56519) network prefixes used by their
services.

### Bingbot

[Bingbot](https://www.bing.com/webmasters/help/help-center-661b2d18) is the web crawler for the Bing search engine.
Bing [publishes](https://www.bing.com/toolbox/bingbot.json) network prefixes used by their crawlers.

### CriminalIP

Query the [CriminalIP](https://www.criminalip.io/) API for information on an IP address/endpoint, with risk ratings, and
Expand Down
12 changes: 12 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ func initConfig(cmd *cobra.Command) error {
sess.Messages.Mu.Unlock()
}

if v.IsSet("providers.bingbot.enabled") {
sess.Providers.Bingbot.Enabled = ToPtr(v.GetBool("providers.bingbot.enabled"))
} else {
sess.Messages.Mu.Lock()
sess.Messages.Info = append(sess.Messages.Info, "Bingbot provider not defined in config")
sess.Messages.Mu.Unlock()
}

sess.Providers.Bingbot.URL = v.GetString("providers.bingbot.url")

sess.Providers.Bingbot.DocumentCacheTTL = v.GetInt64("providers.bingbot.document_cache_ttl")

sess.Providers.CriminalIP.ResultCacheTTL = v.GetInt64("providers.criminalip.result_cache_ttl")
if v.IsSet("providers.digitalocean.enabled") {
sess.Providers.DigitalOcean.Enabled = ToPtr(v.GetBool("providers.digitalocean.enabled"))
Expand Down
3 changes: 3 additions & 0 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"sync"
"time"

"github.com/jonhadfield/ipscout/providers/bingbot"

"github.com/jonhadfield/ipscout/providers/virustotal"

"github.com/jonhadfield/ipscout/providers/google"
Expand Down Expand Up @@ -60,6 +62,7 @@ func getEnabledProviderClients(sess session.Session) (map[string]providers.Provi
{Name: annotated.ProviderName, Enabled: sess.Providers.Annotated.Enabled, APIKey: "", NewClient: annotated.NewProviderClient},
{Name: aws.ProviderName, Enabled: sess.Providers.AWS.Enabled, APIKey: "", NewClient: aws.NewProviderClient},
{Name: azure.ProviderName, Enabled: sess.Providers.Azure.Enabled, APIKey: "", NewClient: azure.NewProviderClient},
{Name: bingbot.ProviderName, Enabled: sess.Providers.Bingbot.Enabled, APIKey: "", NewClient: bingbot.NewProviderClient},
{Name: criminalip.ProviderName, Enabled: sess.Providers.CriminalIP.Enabled, APIKey: sess.Providers.CriminalIP.APIKey, NewClient: criminalip.NewProviderClient},
{Name: digitalocean.ProviderName, Enabled: sess.Providers.DigitalOcean.Enabled, APIKey: "", NewClient: digitalocean.NewProviderClient},
{Name: gcp.ProviderName, Enabled: sess.Providers.GCP.Enabled, APIKey: "", NewClient: gcp.NewProviderClient},
Expand Down
Loading

0 comments on commit 3101fae

Please sign in to comment.