[Dnsmasq-discuss] dhcp-host question

Chris Green cl at isbd.net
Mon Sep 1 21:36:00 BST 2014


On Mon, Sep 01, 2014 at 02:32:50PM -0400, Weedy wrote:
>    What package is hscan part of?
> 
No package at all, it's a little script I wrote myself that uses nmap:-

    #!/bin/bash
    nmap -sP 192.168.1.0/24 | awk '
    /Nmap scan report for/\
        {if (NF == 6) printf("\n%-15.15s  %-26.26s", substr(substr($6, 2), 1, length($6)-2), $5)
         else printf("\n%-43.43s", $5)}
    /MAC Address/\
        {printf("  %s %s %s %s", $3, $4, $5, $6)}
    END {printf("\n")}'

    nmap -sP -T5 192.168.13.0/24 | awk '
    /Nmap scan report for/\
        {if (NF == 6) printf("\n%-15.15s  %-26.26s", substr(substr($6, 2), 1, length($6)-2), $5)
         else printf("\n%-43.43s", $5)}
    /MAC Address/\
        {printf("  %s %s %s %s", $3, $4, $5, $6)}
    END {printf("\n")}'


(and, yes, I know I could have parameterised it rather than simply
repeating the same code twice for my two subnets!)

-- 
Chris Green



More information about the Dnsmasq-discuss mailing list