/ipblocks

Provides subnet information and functionality to divide subnets into blocks. Enabling parallelization of large scanning and network reconnaissance operations.

Primary LanguageGo

IPBlocks

Report Docs Version

Provides subnet information and functionality to divide subnets into blocks. This enables the parallelization of large scanning and network reconnaissance operations.

Documentation

See the docs here.

Install

go get github.com/cbergoon/ipblocks
go install github.com/cbergoon/ipblocks/cmd/ipblockscli

CLI Usage

ipblockscli -h
ipblockscli -s 192.168.9.0/24 -b /26 
ipblockscli -v -s 192.168.9.0/24 -b /26 

CLI Help

Usage of ipblockscli:
  -b string
        size of block to divide subnet into (default "/28")
  -s string
        CIDR representation of subnet to divide (default "192.168.1.0/24")
  -v    output verbose information describing subnet

Example Usage

Below is an example demonstrating calculation of subnet information and dividing a /24 subnet into 16 blocks of /28 address ranges within the /24.

package main

import (
  "crypto/sha256"
  "log"

  "github.com/cbergoon/ipblocks"
)


func main() {
	address := net.IPv4(192, 168, 1, 0)
	originalBlock, _ := ipblocks.NewIPMaskInfo(address, 24, false)
	fmt.Println(originalBlock)

	dividedBlocks, _ := originalBlock.CalculateBlocks(28)
	fmt.Println(dividedBlocks)

	blockRange, _ := originalBlock.CalculateRange(28)
	fmt.Println(blockRange)
}