Скрипты для Linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
704 B

#!/bin/bash
# Copyright 2025 by Alexei Bezborodov <AlexeiBv+linux_script@narod.ru>
# License: Public domain: http://unlicense.org/
# Общественное достояние
[ "${alias_dir}" = "" ] && alias_dir=$(pwd)
source "${alias_dir}/common"
nmap_scan_hosts()
{
in_host_pattern=$1
in_mask=$2
[ "${in_mask}" = "" ] && in_mask=24
[ "${in_host_pattern}" = "" ] && printf "Укажите шаблон адреса без последнего параметра, например '192.168.1'\n" && return
ips=$(nmap -sn ${in_host_pattern}.1/24 | grep 'Nmap scan' | grep -o -E "${in_host_pattern}.[0-9\.]+" | cut -b 8-) && echo ${ips}
}
mkalias_with_prefix 'nmap_scan_hosts'