zoukankan      html  css  js  c++  java
  • ch1_example25_PerlSubnetIPAddressParsing.txt

    1    #!/usr/bin/perl
    2    if(@ARGV<2){print "Usage: $0 <network> <port>\nExample: $0 10.*.*.* 80 or 10.4.*.* 80 or 10.4.3.* 80\n";exit;}
    3    else{
    4      use IO::Socket;
    5      $sIP="@ARGV[0]";
    6      $port="@ARGV[1]";
    7      ($ip1,$ip2,$ip3,$ip4)=split(/\./,$sIP);
    8        if($ip2 == '*')
    9         {$ip2=1; $ip3=1; $ip4=1; $x='a'; print "Scanning a Class A\n";}
    10        elsif($ip3 == '*')
    11         {$ip3=1; $ip4=1; $x='b'; print "Scanning a Class B\n";}    
    12        elsif($ip4 == '*')
    13         {$ip4=1; $x='c'; print "Scanning a Class C\n";}
    14    
    15       while($ip2<255 && $x == 'a')
    16        {
    17            while($ip3<255 && ($x == 'a' || $x == 'b'))
    18            {
    19                while($ip4<255)
    20                {    
    21                        $ipaddr="$ip1.$ip2.$ip3.$ip4";
    22                    print "$ipaddr\n";
    23                           #IP_connect($ipaddr);
    24                          $ip4++;
    25                }
    26            $ip4=1;
    27            $ip3++;
    28            if($x eq 'c') {$ip3=255; $ip2=255;}
    29            }
    30        $ip4=1;
    31        $ip3=1;
    32        $ip2++;
    33        if($x eq 'c' || $x eq 'b') {$ip3=255; $ip2=255;}
    34       }
    35    }
  • 相关阅读:
    2017.3.10组合数学学习——多重集合的排列、组合,有限概率
    poj 3169 Layout
    poj 1201 Intervals
    poj 1716 Integer Intervals
    2017.3.9 组合数学学习——组合、多重集排列
    [HNOI 2013]切糕
    思维相似处总结(未完待续)
    bzoj 3673: 可持久化并查集 by zky
    SDOI2013 森林
    标题还没想好
  • 原文地址:https://www.cnblogs.com/shihao/p/2511314.html
Copyright © 2011-2022 走看看