Bash script to list all IPs in prefix

后端 未结 11 1624
[愿得一人]
[愿得一人] 2020-12-23 12:23

I\'m trying to create script that I can input a set of prefixes, which will then list all IP addresses within the prefixes (including network/host/broadcast).

An ex

11条回答
  •  悲&欢浪女
    2020-12-23 13:14

    Wanted to comment on an answer above but don't have the rep yet.

    Using the top solution with NMAP I added this to my .bashrc

    expand-ip() {
      nmap -sL -n -iL "$1" | awk '/Nmap scan report/{print $NF}'
    }
    

    Now I can use this with just expand-ip targs.

提交回复
热议问题