亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 4405 | 回復: 4
打印 上一主題 下一主題

分享我的局域網(wǎng)ip掃描的小腳本 [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-09-10 22:25 |只看該作者 |倒序瀏覽
  1. #!/usr/bin/perl


  2. ################################
  3. # this script is using to scan the lan 's ip.
  4. # this can show how much ip is in using.
  5. # auth by redpig315,^_^
  6. ###############################


  7. use strict;
  8. use warnings;

  9. open(Fh,">iptable");
  10. print Fh "iplist\n";
  11. close(Fh);
  12. open(Fh,">>iptable");

  13. my $iphead="192.168.250.";
  14. my $i=1;
  15. my $count=0;
  16. while($i++<255){
  17. my $ip =$iphead.$i;
  18. my $node=$ip;
  19. my $state=!system("ping -c        1 -w 1 -q $node 1>/dev/null 2>&1");
  20. if(!$state){
  21.    print "$node is  offline\n";

  22. }else{
  23.      $count++;
  24.    print "$node is online\n";
  25.    print Fh "$node\n";
  26. }

  27. $ip=$iphead;
  28. }
  29. close(Fh);

  30. print "total $count 's ip online\n";

  31. my $offip=255-$count;

  32. print "total $offip 's ip offline\n";

復制代碼
通過修改iphead的值,填入要掃描的局域網(wǎng)ip,對本網(wǎng)段的ip進行可用性統(tǒng)計,結(jié)果記錄在iptable中,并顯示可用ip數(shù)。

論壇徽章:
0
2 [報告]
發(fā)表于 2011-09-11 10:18 |只看該作者
可用的IP數(shù),是指正在使用的IP數(shù),還是能用的IP數(shù)?

論壇徽章:
0
3 [報告]
發(fā)表于 2011-09-11 14:23 |只看該作者
正在使用的ip.若要知道可用的ip數(shù),改一下上面保存數(shù)據(jù)的位置就ok 了。

論壇徽章:
0
4 [報告]
發(fā)表于 2011-09-11 17:47 |只看該作者
通過修改iphead的值,填入要掃描的局域網(wǎng)ip,對本網(wǎng)段的ip進行可用性統(tǒng)計,結(jié)果記錄在iptable中,并顯示可用 ...
xiucai315 發(fā)表于 2011-09-10 22:25


shell幾句代碼的事

    for c in 1..255;do
ping  ....
done

如果 用 perl的話 ,試著 用多線程 ,或者 輸出一個比較漂亮的 報表 ,可能意義更大些  

論壇徽章:
0
5 [報告]
發(fā)表于 2011-09-15 23:33 |只看該作者
樓上兄弟:上面3行代碼能搞定嗎?

用fping 可以。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP