lanscan

package module
v0.0.0-...-2a77f89 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2019 License: MIT Imports: 4 Imported by: 5

README

Lanscan - Blazing fast, local network scanning in Go

Build Status Go Report Card license

Introduction

Lanscan is a small, blazing fast and easy to use golang library to scan for hosts in your local network. It's job is to identify hosts nearby that are listening on a specified port. The goal is to make scans like these as fast and simple as possible. Just provide a port, the number of parallel threads and a timeout. Lanscan will take care of the rest...

Features

  • Automatic restriction to your link local network
  • Automatic prioritization of nearby IPs
  • Automatic scan on all network interfaces
  • Automatic adaption to your network latency
  • Full support for parallel scanning
  • Ability to stop after a timeout

Getting started

package main

import "github.com/stefanwichmann/lanscan"
import "time"
import "log"

func main() {
  // Scan for hosts listening on tcp port 80.
  // Use 20 threads and timeout after 5 seconds.
  hosts, err := lanscan.ScanLinkLocal("tcp4", 80, 20, 5*time.Second)
  if err != nil {
    log.Fatal(err)
  }
  for _, host := range hosts {
    log.Printf("Host %v responded.", host)
  }
}

Status

Lanscan is still work in progress and far from done! Right now it's working stable in an IPv4 environment when scanning for TCP services. Once a TCP handshake is successfully completed Lanscan considers the host reachable. Open tasks right now are:

  • IPv6 discovery
  • UDP discovery
  • Provide a proper command line tool for scanning

Documentation

Overview

Package lanscan contains a blazing fast port scanner for local networks

Package lanscan contains a blazing fast port scanner for local networks

Package lanscan contains a blazing fast port scanner for local networks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSubnetIPs

func CalculateSubnetIPs(cidr string, maxAddresses int) []string

CalculateSubnetIPs will calculate a given maximum of addresses in the given cidr address space.

func IsLinkLocalAddress

func IsLinkLocalAddress(ip net.IP) bool

IsLinkLocalAddress will check if the given IP address is considered link local.

func LinkLocalAddresses

func LinkLocalAddresses(network string) []string

LinkLocalAddresses returns all link local IP addresses for the given network.

func ProbeHosts

func ProbeHosts(hosts <-chan string, port int, protocol string, respondingHosts chan<- string, done chan<- bool)

ProbeHosts will read hosts to probe from the given channel and check the given port and protocol for each of them. Responding hosts will be written back into the second channel.

func ScanLinkLocal

func ScanLinkLocal(network string, port int, threads int, timeout time.Duration) ([]string, error)

ScanLinkLocal scans all link local networks on all interfaces found on the current computer for hosts responding on the given port. It will use the given amout of threads and will return after the given timeout or after finishing the scan.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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