• MTK@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    4 hours ago

    Yeah? No looking it up, give me a bash script for a ping scan of a subnet with a 24 bit mask.

    • dream_weasel@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      32 minutes ago

      #!/bin/bash

      ping 255.255.255.0 > checker &

      sleep 5

      kill “$!”

      grep unreachable checker || echo ‘255.255.255.0’

      ping 255.255.255.1 > checker &

      sleep 5

      kill “$!”

      grep unreachable checker || echo ‘255.255.255.1’

      ping 255.255.255.2 > checker &

      sleep 5

      kill “$!”

      grep unreachable checker || echo ‘255.255.255.2’

      Did I do it coach? 😭

    • gens@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 hours ago

      nmap -sn x.x.0.0/24 I think, was a while. Pure coincidence how I know.

      Edit: no, it’s one less x because 16 is the middle.