Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| #!/bin/bash | |
| greenB='\x1b[1;32m'; end='\x1b[0m'; redB='\x1b[1;31m'; blueB='\x1b[1;34m' | |
| info=`ip route|grep -m 1 '0/24'` | |
| echo -e "本机IP是:$greenB`echo $info|awk '{print $9}'`$end" | |
| ip=`echo $info|awk '{print $1}'` | |
| echo "扫描 $ip 段" | |
| if [ $1 ]; then | |
| # 端口,MAC地址 | |
| sudo /usr/bin/nmap -sS $ip|sed -e "/^Interest/ s/[1-9][0-9.]\{6,14\}/${greenB}&${end}/g" -e "/open/ s/[^\ ]*$/${redB}&${end}/g" -e "/^MAC/ s/[0-9:A-F]\{17\}/${blueB}&${end}/g" | |
| else | |
| # 如果对方关闭了icmp,就探测不到 | |
| /usr/bin/nmap -sP $ip|sed "s/[1-9][0-9.]\{6,14\}/${greenB}&${end}/g" | |
| fi | |