cdncheck

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cdncheck

Helper library that checks if a given IP belongs to known CDN ranges (akamai, cloudflare, incapsula, sucuri and leaseweb). The library can be used by importing github.com/projectdiscovery/cdncheck. here follows a basic example:

package main

import (
    "log"
    "net"
    "github.com/projectdiscovery/cdncheck"
)

func main() {
    // uses projectdiscovery endpoint with cached data to avoid ip ban
    // Use cdncheck.New() if you want to scrape each endpoint (don't do it too often or your ip can be blocked)
    client, err := cdncheck.NewWithCache()
    if err != nil {
        log.Fatal(err)
    }
    if found, err := client.Check(net.ParseIP("173.245.48.12")); found && err == nil {
        log.Println("ip is part of cdn")
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Options *Options
	// contains filtered or unexported fields
}

Client checks for CDN based IPs which should be excluded during scans since they belong to third party firewalls.

func New

func New() (*Client, error)

New creates a new firewall IP checking client.

func NewWithCache

func NewWithCache() (*Client, error)

NewWithCache creates a new firewall IP with cached data from project discovery (faster)

func NewWithOptions

func NewWithOptions(Options *Options) (*Client, error)

NewWithOptions creates a new instance with options

func (*Client) Check

func (c *Client) Check(ip net.IP) (bool, string, error)

Check checks if an IP is contained in the blacklist

func (*Client) Ranges

func (c *Client) Ranges() map[string][]string

Ranges returns the providers and ranges for the cdn client

type Options

type Options struct {
	Cache        bool
	IPInfoToken  string
	UrlFromRange string
}

func (*Options) HasAuthInfo

func (options *Options) HasAuthInfo() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址