ifconfig p32p1|egrep -o "broadcast [^ ]*" |grep -o "[0-9.]*"
grep -o "broadcast [^ ]*" 標示以broadcast開始,以非空格字符(由[^ ]*指定)序列做爲結束,
[0-9.]標示數字和點號,後面的*若是不加將每一個數字佔一行web
查找網內活躍的IP地址
#!/bin/sh
#()&後臺並行執行
#wait 等待全部子程序結束
for ip in 192.168.5.{21..254};
do
(
ping $ip -c2 &> /dev/null;
if [ $? -eq 0 ]
then
echo $ip is alive
fi
)&
done
wait
能夠經過fping和nmap命令得到bash
自動傳輸文件
[root@localhost root]# cat /usr/local/bin/r_ftp
#!/bin/baship
USER=root
PASS=passwordhash
SERVER=192.168.5.23
RPATH="/web/cgi-bin/"
SourceFile=$1it
ftp -n << EOF
open $SERVER
user $USER $PASS
binary
hash
cd $RPATH
put $SourceFile
bye
EOFast