首页 > 代码库 > I'am The first script

I'am The first script

扫描局域网中的地址,然后只对up的机器发2次包

[root@localhost ~]# cat /etc/centos-release
CentOS release 6.7 (Final)

[root@localhost ~]# uname -a
Linux localhost 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

 

#!/bin/bash
clear
date +%y-%m-%d-%H:%M:%S
mount /dev/sr0 /mnt/usb1
wget https://nmap.org/dist/nmap-7.50.tar.bz2
tar -jxvf nmap-7.50.tar.bz2
cd ./nmap-7.50
yum -y install gcc*
./configure -prefix=/usr/local/opop && make && make install
ln -s /usr/local/opop/bin/nmap /bin
for p in `nmap -sn 192.168.0.0/24 |grep $192.168|awk -F "(" ‘{print $2}‘ | sed ‘s/)//g‘`
do
echo "the ip of $p computer is"
ping -c 2 $p
done

 

I'am The first script