utils

package
v0.0.0-...-21ab0d4 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Code taken and customized from https://raw.githubusercontent.com/projectdiscovery/mapcidr/24b047bfd50376c9e7f17123006d56cd6481d1e9/ip.go

Index

Constants

View Source
const Version = `0.0.3`

Version is the current version of dnsx

Variables

View Source
var Values []string

Functions

func CheckNumber

func CheckNumber(cidr string) bool

func GetHTTPRequest

func GetHTTPRequest(url string, headers map[string]string) *fasthttp.Response

GET HTTP wrapper

func GetNextIP

func GetNextIP(ip net.IP) net.IP

GetNextIP returns the next IP from the given IP address. If the given IP is the last IP of a v4 or v6 range, the same IP is returned.

func MergeChannels

func MergeChannels(channels ...<-chan Result) <-chan Result

Merge multiple channels from type Result

func PostHTTPRequest

func PostHTTPRequest(url string, data []byte) *fasthttp.Response

POST HTTP wrapper

func PrintResults

func PrintResults(json bool, results <-chan Result)

Print results based on the given parameters

func RemoveDuplicates

func RemoveDuplicates(input <-chan Result) <-chan Result

Remove duplicates from a channel and return a channel from type Result

func RipeToCIDR

func RipeToCIDR(result string) (r []*net.IPNet)

func ShowBanner

func ShowBanner()

showBanner is used to show the banner to the user

func WriteJSON

func WriteJSON(results <-chan Result)

Print results as JSON

Types

type Options

type Options struct {
	SearchString string // Client to find CIDRs for"
	Silent       bool   // Show only results in output
	Stdin        bool   // Stdin specifies whether stdin input was given to the process
	Version      bool   // Version specifies if we should just show version and exit
	JSON         bool   // JSON output
	Output       io.Writer
}

Options

func ParseOptions

func ParseOptions() *Options

ParseOptions parses the command line flags provided by a user

type Result

type Result struct {
	Name   string
	Value  string
	Source string
}

Jump to

Keyboard shortcuts

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