| liugr3988 回复于:2004-05-21 21:56:23 |
| hao |
| handsun 回复于:2004-05-22 12:19:44 |
| 收下 :em02: |
| liugr3988 回复于:2004-05-22 15:59:50 |
| 好文章 |
| aerfa 回复于:2004-05-22 16:35:55 |
| shouxia |
| hbczjzc 回复于:2004-05-22 22:42:38 |
| 好啊 |
| fanzhonghai 回复于:2004-05-23 00:47:00 |
| 不管能否正确使用,先谢谢再说 |
| jackwb 回复于:2004-05-23 13:59:41 |
| thankyou!! |
| sdccf 回复于:2004-05-23 14:11:29 |
| 没问题。 |
| slnhghm 回复于:2004-05-23 16:44:39 |
| 实时自动监控并生成日志怎么做??? |
| alpha_sun_ux9000 回复于:2004-05-23 23:31:08 |
| 谢谢 |
| 绣林 回复于:2004-05-24 08:49:05 |
| 好文章,收下了。 |
| zfl 回复于:2004-05-24 09:31:03 |
| 收了先 |
| aixcq 回复于:2004-05-24 15:51:34 |
| rm: jlog.*: A file or directory in the path name does not exist.
&°Äú&Ä&&ÄÔÒѱ&ÏÂÁмÆË&&úÔ&³Ì&Ǽ: &± &°IP&ØÖ· ÒÔÌ&Í&&ØÖ· &Ǽ·½Ê½ &ǼÓÃ&§ ½&³Ì&Å &Ǽʱ¼&&± ./liu2004[18]: jlog.net: not found. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. ./liu2004[20]: test: 0403-004 Specify a parameter with this command. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. cat: 0652-050 Cannot open jlog.tmp. grep: 0652-033 Cannot open &±. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. ./liu2004[37]: jlog.pnet: not found. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. ./liu2004[39]: test: 0403-004 Specify a parameter with this command. cat: 0652-050 Cannot open jlog.tmp. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. ./liu2004[73]: jlog.pftp: not found. Syntax Error The source line is 1. The error context is >>> & <<< awk: 0602-540 There is a missing } character. awk: 0602-500 Quitting The source line is 1. ./liu2004[75]: test: 0403-004 Specify a parameter with this command. |
| hgh25emus 回复于:2004-05-24 16:30:06 |
| 老法王,真的好用吗?
我看那个jlog.tmp 被删除了怎么又有 echo $na >>jlog.tmp 呢? 能不能做个.sh 可以下载让我试一下啊? |
| nmwr 回复于:2004-05-28 06:52:13 |
| 很好 |
| sindney 回复于:2004-05-28 08:51:01 |
| 老大又弄了一个好东东:) |
| zhum003 回复于:2004-05-28 12:26:10 |
| 我试用了一下,发生如下错误: test: unknown operator 21,是哪错了? |
| scyibin 回复于:2004-05-28 15:35:09 |
| 好东东 |
| dintan 回复于:2004-05-28 18:19:37 |
| 在我的機器上修改後才可以用:
rm jlog.* #檢查有無遠端登錄的電腦 ps -ef|grep rlogind|grep -v grep >jlog.tmp ps -ef|grep telnetd|grep -v grep>>jlog.tmp ps -ef|grep ftpd|grep -v grep >>jlog.tmp if [ -f jlog.tmp ] then echo “您的電腦已被下列電腦遠端登錄: ” echo “IP位址 乙太網位址 登錄方式 登錄用戶 進程號 登錄時間” sort +4 jlog.tmp >jlog.ps rm jlog.tmp cat jlog.ps|grep -v ftpd >jlog.pnet cat jlog.ps|grep ftpd >jlog.pftp #區分遠端登錄方式 netstat -n |grep ESTABLISHED>jlog.net if [ -f jlog.net ] then nsum=丶wc jlog.net|awk ‘{print $1}’丶 i=0 while [ $i -lt $nsum ] do i=丶expr $i + 1丶 na=丶head -$i jlog.net|tail -1丶 nmode=丶echo $na |awk ‘{print $4}’|cut -f5 -d.丶 if [“$nmode” -eq 21 -o “$nmode” -eq 23 -o “$nmode” -eq 513 ] then echo $na >>jlog.tmp fi done fi #獲取以telnet、rlogin遠端登錄的電腦的登錄關鍵資訊 if [ -f jlog.pnet ] then cat jlog.tmp|grep -v “.21 ”|awk ‘{print $5}’|cut -f1,2,3,4 -d. >jlog.nett who |sort +4 |grep ttyp|awk ‘{print $1}’>jlog.who #獲取遠端登錄電腦的總數 tsum=丶wc jlog.pnet|awk ‘{print $1};’丶 i=0 while [ $i -lt $tsum ] do i=丶expr $i + 1丶 ta=丶head -$i jlog.pnet|tail -1丶 #獲取遠端登錄的電腦的用戶 tuser=丶head -$i jlog.who|tail -1丶 #獲取遠端登錄的電腦的IP位址 tip=丶tail -$i jlog.nett|head -1丶 tb=丶head -$i jlog.pnet|tail -1|awk ‘{print $8}’丶 #獲取遠端登錄的電腦的登錄方式 if [“$tb” = “telnetd” ] then tmode=“telnet” else tmode=“rlogin” fi #獲取遠端登錄的電腦的登錄時間 tpro=丶echo $ta|awk ‘{print $2}’丶 #獲取遠端登錄的電腦的進程號 ttime=丶echo $ta|awk ‘{print $5}’丶 #獲取遠端登錄的電腦的乙太網位址 teth=丶arp -a|grep $tip |head -1|awk ‘{print $4}’丶 if [“$teth” = “” ] then teth=“ ” fi echo “$tip $teth $tmode $tuser $tpro $ttime” done fi #獲取以ftp遠端登錄的電腦關鍵資訊 if [ -f jlog.pftp ] then cat jlog.tmp|grep “.21” |awk ‘{print $5}’|cut -f1,2,3,4 -d. >jlog.netf #獲取以ftp遠端登錄的電腦的總數 fsum=丶wc jlog.pftp|awk ‘{print $1}’丶 i=0 while [ $i -lt $fsum ] do i=丶expr $i + 1丶 fa=丶head -$i jlog.pftp|tail -1丶 #獲取以ftp遠端登錄的電腦的用戶 fuser=丶echo $fa|awk ‘{print $1}’丶 #獲取以ftp遠端登錄的電腦的登錄時間 ftime=丶echo $fa|awk ‘{print $5}’丶 #獲取以ftp遠端登錄的電腦的IP位址 fip=丶tail -$i jlog.netf|head -1丶 #獲取以ftp登錄的電腦的登錄方式 fb=丶echo $fa|awk ‘{print $8}’丶 fmode=“ftp” #獲取以ftp登錄的電腦的進程號 fpro=丶echo $fa|awk ‘{print $2}’丶 #獲取以ftp登錄的電腦乙太網位址 feth=丶arp -a|grep $fip |head -1|awk ‘{print $4}’丶 if [“$feth” = “” ] then feth=“ ” fi echo “$fip $feth $fmode $fuser $fpro $ftime” done fi else echo “未發現遠端登錄的電腦!” fi |
| geekchi 回复于:2004-05-29 10:15:59 |
| 好用,已测试过了。 |
| xxhe 回复于:2004-05-29 11:08:14 |
| 谢谢啊 |
| yuansonghui 回复于:2004-05-29 12:26:26 |
| 好东东.谢谢了.那么长的shell,你们是怎输入的,有没有更快的办法可以自已测试一下. |
| yuansonghui 回复于:2004-05-29 12:27:54 |
| 好东东.谢谢了.那么长的shell,你们是怎输入的,有没有更快的办法可以自已测试一下. |
| 草中宝 回复于:2004-05-29 22:10:44 |
| 这个不错,支持了 |
| aixcq 回复于:2004-06-01 10:39:46 |
| °Äú&Ä&&ÄÔÒѱ&ÏÂÁмÆË&&úÔ&³Ì&Ǽ: &±
&°IP&ØÖ· ÒÔÌ&Í&&ØÖ· &Ǽ·½Ê½ &ǼÓÃ&§ ½&³Ì&Å &Ǽʱ¼&&± jlog: jlog.net: command not found awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression jlog: [: 0: unary operator expected cat: jlog.tmp: No such file or directory grep: &±: No such file or directory awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression jlog: jlog.pnet: command not found awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression jlog: [: 0: unary operator expected cat: jlog.tmp: No such file or directory awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression jlog: jlog.pftp: command not found awk: cmd. line:1: &&{print awk: cmd. line:1: ^ Invalid char '&' in expression jlog: [: 0: unary operator expected |
| sdccf 回复于:2004-06-01 13:42:07 |
| 可能你复制的时候出现乱字符了(^M) |