Executando verificação de segurança...
1

O que creio que seja uma solução para esse caso específico usando https://www.npmjs.com/package/local-devices e https://www.npmjs.com/package/ping para obter dispositivos integrantes na rede seja essa:

const find = require('local-devices')
const ping = require('ping')

find({ address: '192.168.0.1/24' }).then(devices => {
  const hosts = devices.map(({ip}) => ip)
  hosts.forEach(function(host) {
    ping.sys.probe(host, function(isAlive) {
      const msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead'
      console.log(msg)
    })
  })
})

Mas se é inevitável a necessidade de executar comandos do sistema, pesquise mais sobre o modulo OS do node https://nodejs.org/api/os.html

Uma solução sem biblioteca que não é lá o ideal, não use de forma alguma esse código não testado para nada sério...

const util = require('util')
const exec = util.promisify(require("child_process").exec);
const ip = require('ip')

async function arp_all() {
  const { stdout, stderr } = await exec('arp -a')
  
  if (stderr) {
    return Promise.reject(new Error(`Erro no command arp. ${stderr}`))
  }

  return stdout
}

function parse_arp_table( table ) {
  const lines = table.split('\r\n')

  //Não julgue, não entendo absolutamente nada de regex.
  const is_line_ip = line => line.match(/^\s*\b(?:\d{1,3}\.){3}\d{1,3}\b/gm)
  const combine_groups = line => {
    const [ ip, mac, type ] = line.match(/([^ \n]+)/g)
    return { ip, mac, type }
  }
  const is_ip_valid = host => ip.isV4Format(host.ip) && ip.isV6Format(host.ip)

  const content = lines.filter( is_line_ip )
                       .map( combine_groups )
                       .filter( is_ip_valid )
  
  return content
}

async function find_all( ) {
  const table = await arp_all()
  const parse_result = parse_arp_table(table)
  return parse_result
}                            


async function ping( host ) {
  const { stdout, stderr } = await exec(`ping ${host}`)

  if (stderr) {
    return Promise.reject(new Error(`Ping command failed. ${stderr}`))
  }

  return true
}


find_all().then(devices => {
  const hosts = devices.map(({ip}) => ip)
  
  hosts.map(host => {
    ping(host).then(status => {
      console.log(`Host: ${host} -- Status alive`)
    }).catch(error => {
      if (error.code === 1) {
        console.log(`Host: ${host} -- Timed out`)
      }
    })
  })
})
Carregando publicação patrocinada...