µ±Ç°Î»ÖãºLinux½Ì³Ì - Linux - ºÚ¿Í±Ø¶Á(Áù)

ºÚ¿Í±Ø¶Á(Áù)



         µÚÆßÕ¡¡¶Ë¿ÚɨÃè
    ¡¡¡¡Ò»¸ö¶Ë¿Ú¾ÍÊÇÒ»¸öDZÔÚµÄͨÐÅͨµÀ£¬Ò²¾ÍÊÇÒ»¸öÈëÇÖͨµÀ¡£¶ÔÄ¿±ê¼ÆËã»ú½øÐж˿ÚɨÃ裬Äܵõ½Ðí¶àÓÐÓõÄÐÅÏ¢¡£½øÐÐɨÃèµÄ·½·¨ºÜ¶à£¬¿ÉÒÔÊÇÊÖ¹¤½øÐÐɨÃ裬Ҳ¿ÉÒÔÓö˿ÚɨÃèÈí¼þ½øÐС£
    ¡¡¡¡ÔÚÊÖ¹¤½øÐÐɨÃèʱ£¬ÐèÒªÊìϤ¸÷ÖÖÃüÁî¡£¶ÔÃüÁîÖ´ÐкóµÄÊä³ö½øÐзÖÎö¡£ÓÃɨÃèÈí¼þ½øÐÐɨÃèʱ£¬Ðí¶àɨÃèÆ÷Èí¼þ¶¼ÓзÖÎöÊý¾ÝµÄ¹¦ÄÜ¡£
    ¡¡¡¡Í¨¹ý¶Ë¿ÚɨÃ裬¿ÉÒԵõ½Ðí¶àÓÐÓõÄÐÅÏ¢£¬´Ó¶ø·¢ÏÖϵͳµÄ°²È«Â©¶´¡£
    ¡¡¡¡ÏÂÃæÊ×ÏȽéÉܼ¸¸ö³£ÓÃÍøÂçÃüÁ¶Ô¶Ë¿ÚɨÃèÔ­Àí½øÐнéÉÜ£¬È»ºóÌṩһ¸ö¼òµ¥µÄɨÃè³ÌÐò¡£
    µÚÒ»½Ú¡¡¼¸¸ö³£ÓÃÍøÂçÏà¹ØÃüÁî
    PingÃüÁî¾­³£ÓÃÀ´¶ÔTCP/IPÍøÂç½øÐÐÕï¶Ï¡£Í¨¹ýÄ¿±ê¼ÆËã»ú·¢ËÍÒ»¸öÊý¾Ý°ü£¬ÈÃËü½«Õâ¸öÊý¾Ý°ü·´ËÍ»ØÀ´£¬Èç¹û·µ»ØµÄÊý¾Ý°üºÍ·¢Ë͵ÄÊý¾Ý°üÒ»Ö£¬ÄǾÍÊÇ˵ÄãµÄPINGÃüÁî³É¹¦ÁË¡£Í¨¹ýÕâÑù¶Ô·µ»ØµÄÊý¾Ý½øÐзÖÎö£¬¾ÍÄÜÅжϼÆËã»úÊÇ·ñ¿ª×Å£¬»òÕßÕâ¸öÊý¾Ý°ü´Ó·¢Ë͵½·µ»ØÐèÒª¶àÉÙʱ¼ä¡£

    PingÃüÁîµÄ»ù±¾¸ñʽ£º
    ping hostname

    ¡¡¡¡ÆäÖÐhostnameÊÇÄ¿±ê¼ÆËã»úµÄµØÖ·¡£Ping»¹ÓÐÐí¶à¸ß¼¶Ê¹Óã¬ÏÂÃæ¾ÍÊÇÒ»¸öÀý×Ó¡£
    C:> ping -f hostname
    ¡¡¡¡ÕâÌõÃüÁî¸øÄ¿±ê»úÆ÷·¢ËÍ´óÁ¿µÄÊý¾Ý£¬´Ó¶øʹĿ±ê¼ÆËã»úæÓÚ»ØÓ¦¡£ÔÚWindows 95µÄ¼ÆËã»úÉÏ£¬Ê¹ÓÃÏÂÃæµÄ·½·¨£º
    c:\\windows\\ping -l 65510 saddam_hussein\"s.computer.mil
    ¡¡¡¡ÕâÑù×öÁËÖ®ºó£¬Ä¿±ê¼ÆËã»úÓпÉÄÜ»á¹ÒÆðÀ´£¬»ò´ÓÐÂÆô¶¯¡£ÓÉÓÚ -l 65510 ²úÉúÒ»¸ö¾Þ´óµÄÊý¾Ý°ü¡£ÓÉÓÚÒªÇó·µ»ØÒ»¸öͬÑùµÄÊý¾Ý°ü£¬»áʹĿ±ê¼ÆËã»ú·´Ó¦²»¹ýÀ´¡£
    ¡¡¡¡ÔÚLinux¼ÆËã»úÉÏ£¬¿ÉÒÔ±àдһ¸ö³ÌÐòÀ´ÊµÏÖÉÏÊö·½·¨¡£
    #include < stdio.h>
    #include < sys/types.h>
    #include < sys/socket.h>
    #include < netdb.h>
    #include < netinet/in.h>
    #include < netinet/in_systm.h>
    #include < netinet/ip.h>
    #include < netinet/ip_icmp.h>

    /*
    * If your kernel doesn\"t muck with raw packets, #define REALLY_RAW.
    * This is probably only Linux.
    */
    #ifdef REALLY_RAW
    #define FIX(x) htons(x)
    #else
    #define FIX(x) (x)
    #endif

    int
    main(int argc, char **argv)
    {
    int s;
    char buf[1500];
    struct ip *ip = (struct ip *)buf;
    struct icmp *icmp = (struct icmp *)(ip + 1);
    struct hostent *hp;
    struct sockaddr_in dst;
    int offset;
    int on = 1;

    bzero(buf, sizeof buf);
    if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_IP)) < 0) {
    perror(\"socket\");
    exit(1);
    }
    if (setsockopt(s, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0) {
    perror(\"IP_HDRINCL\");
    exit(1);
    }
    if (argc != 2) {
    fprintf(stderr, \"usage: %s hostname\\n\", argv[0]);
    exit(1);
    }
    if ((hp = gethostbyname(argv[1])) == NULL) {
    if ((ip->ip_dst.s_addr = inet_addr(argv[1])) == -1) {
    fprintf(stderr, \"%s: unknown host\\n\", argv[1]);
    }
    } else {
    bcopy(hp->h_addr_list[0], &ip->ip_dst.s_addr, hp->h_length);
    }

    printf(\"Sending to %s\\n\", inet_ntoa(ip->ip_dst));
    ip->ip_v = 4;
    ip->ip_hl = sizeof *ip >> 2;
    ip->ip_tos = 0;
    ip->ip_len = FIX(sizeof buf);
    ip->ip_id = htons(4321);
    ip->ip_off = FIX(0);
    ip->ip_ttl = 255;
    ip->ip_p = 1;
    ip->ip_sum = 0; /* kernel fills in */
    ip->ip_src.s_addr = 0; /* kernel fills in */

    dst.sin_addr = ip->ip_dst;
    dst.sin_family = AF_INET;

    icmp->icmp_type = ICMP_ECHO;
    icmp->icmp_code = 0;
    icmp->icmp_cksum = htons(~(ICMP_ECHO < < 8));
    /* the checksum of all 0\"s is easy to compute */

    for (offset = 0; offset < 65536; offset += (sizeof buf - sizeof *ip)) {
    ip->ip_off = FIX(offset >> 3);
    if (offset < 65120)
    ip->ip_off |= FIX(IP_MF);
    else
    ip->ip_len = FIX(418); /* make total 65538 */
    if (sendto(s, buf, sizeof buf, 0, (struct sockaddr *)&dst,
    sizeof dst) < 0) {
    fprintf(stderr, \"offset %d: \", offset);
    perror(\"sendto\");
    }
    if (offset == 0) {
    icmp->icmp_type = 0;
    icmp->icmp_code = 0;
    icmp->icmp_cksum = 0;
    }
    }
    }

    TracertÃüÁîÓÃÀ´¸ú×ÙÒ»¸öÏûÏ¢´Óһ̨¼ÆËã»úµ½Áíһ̨¼ÆËã»úËù×ߵķ¾¶£¬±È·½Ëµ´ÓÄãµÄ¼ÆËã»ú×ßµ½Õã½­ÐÅÏ¢³¬ÊС£ÔÚDOS´°¿ÚÏ£¬ÃüÁîÈçÏ£º
    C:\\WINDOWS>tracert 202.96.102.4

    Tracing route to 202.96.102.4 over a maximum of 30 hops
    1 84 ms 82 ms 95 ms 202.96.101.57 2 100 ms 100 ms 95 ms 0fa1.1-rtr1-a-hz1.zj.CN.NET [202.96.101.33] 3 95 ms 90 ms 100 ms 202.101.165.1 4 90 ms 90 ms 90 ms 202.107.197.98 5 95 ms 90 ms 99 ms 202.96.102.4 6 90 ms 95 ms 100 ms 202.96.102.4
    Trace complete.
    ¡¡¡¡ÉÏÃæµÄÕâЩÊä³ö´ú±íʲôÒâ˼£¿×ó±ßµÄÊý×ÖÊǸ÷ÓÉͨ¹ýµÄ¼ÆËã»úÊýÄ¿¡£\"150 ms\"ÊÇÖ¸ÏòÄÇ̨¼ÆËã»ú·¢ËÍÏûÏ¢µÄÍù·µÊ±¼ä£¬µ¥Î»ÊÇ΢Ãë¡£ÓÉÓÚÿÌõÏûϢÿ´ÎµÄÀ´»ØµÄʱ¼ä²»Ò»Ñù£¬tracert½«ÏÔʾÀ´»Øʱ¼äÈý´Î¡£\"*\"±íʾÀ´»Øʱ¼äÌ«³¤£¬tracert½«Õâ¸öʱ¼ä¡°ÍüµôÁË¡±¡£ÔÚʱ¼äÐÅÏ¢µ½À´ºó£¬¼ÆËã»úµÄÃû×ÖÐÅÏ¢Ò²µ½ÁË¡£¿ªÊ¼ÊÇÒ»ÖÖ±ãÓÚÈËÃÇÔĶÁµÄ¸ñʽ£¬ ½Ó×ÅÊÇÊý×Ö¸ñʽ¡£

    C:\\WINDOWS>tracert 152.163.199.56

    Tracing route to dns-aol.ANS.NET [198.83.210.28]over a maximum of 30 hops:
    1 124 ms 106 ms 105 ms 202.96.101.57 2 95 ms 95 ms 90 ms 0fa1.1-rtr1-a-hz1.zj.CN.NET [202.96.101.33] 3 100 ms 90 ms 100 ms 202.101.165.1 4 90 ms 95 ms 95 ms 202.97.18.241 5 105 ms 105 ms 100 ms 202.97.18.93 6 100 ms 99 ms 100 ms 202.97.10.37 7 135 ms 98 ms 100 ms 202.97.9.78 8 760 ms 725 ms 768 ms gip-ftworth-4-serial8-3.gip.net [204.59.178.53] 9 730 ms 750 ms 715 ms gip-ftworth-4-serial8-3.gip.net [204.59.178.53] 10 750 ms 785 ms 772 ms 144.232.11.9 11 740 ms 800 ms 735 ms sl-bb11-pen-2-0.sprintlink.NET [144.232.8.158] 12 790 ms 800 ms 735 ms sl-nap2-pen-4-0-0.sprintlink.net [144.232.5.66] 13 770 ms 800 ms 800 ms p219.t3.ans.net [192.157.69.13] 14 775 ms 820 ms 780 ms h14-1.t60-6.Reston.t3.ANS.NET [140.223.17.18] 15 780 ms 800 ms 800 ms h11-1.t60-2.Reston.t3.ANS.NET [140.223.25.34] 16 790 ms 795 ms 800 ms h14-1.t104-0.Atlanta.t3.ANS.NET [140.223.65.18] 17 * h14-1.t104-0.Atlanta.t3.ANS.NET [140.223.65.18] reports: Destination host unreachable.
    Trace complete.

    rusersºÍfinger
    ¡¡¡¡ÕâÁ½¸ö¶¼ÊÇUnixÃüÁͨ¹ýÕâÁ½¸öÃüÁÄãÄÜÊÕ¼¯µ½Ä¿±ê¼ÆËã»úÉϵÄÓйØÓû§µÄÏûÏ¢¡£
    ʹÓÃrusersÃüÁ²úÉúµÄ½á¹ûÈçÏÂʾÒ⣺
    gajake snark.wizard.com:ttyp1 Nov 13 15:42 7:30 (remote)
    root snark.wizard.com:ttyp2 Nov 13 14:57 7:21 (remote)
    robo snark.wizard.com:ttyp3 Nov 15 01:04 01 (remote)
    angel111 snark.wizard.com:ttyp4 Nov14 23:09 (remote)
    pippen snark.wizard.com:ttyp6 Nov 14 15:05 (remote)
    root snark.wizard.com:ttyp5 Nov 13 16:03 7:52 (remote)
    gajake snark.wizard.com:ttyp7 Nov 14 20:20 2:59 (remote)
    dafr snark.wizard.com:ttyp15Nov 3 20:09 4:55 (remote)
    dafr snark.wizard.com:ttyp1 Nov 14 06:12 19:12 (remote)
    dafr snark.wizard.com:ttyp19Nov 14 06:12 19:02 (remote)

    ¡¡¡¡×î×ó±ßµÄÊÇͨ¹ýÔ¶³ÌµÇ¼µÄÓû§Ãû¡£»¹°üÀ¨ÉϴεǼʱ¼ä£¬Ê¹ÓõÄSHELLÀàÐ͵ȵÈÐÅÏ¢¡£
    ¡¡¡¡Ê¹ÓÃfinger¿ÉÒÔ²úÉúÀàËÆÏÂÃæµÄ½á¹û£º
    user S00 PPP ppp-122-pm1.wiza Thu Nov 14 21:29:30 - still logged in
    user S15 PPP ppp-119-pm1.wiza Thu Nov 14 22:16:35 - still logged in
    user S04 PPP ppp-121-pm1.wiza Fri Nov 15 00:03:22 - still logged in
    user S03 PPP ppp-112-pm1.wiza Thu Nov 14 22:20:23 - still logged in
    user S26 PPP ppp-124-pm1.wiza Fri Nov 15 01:26:49 - still logged in
    user S25 PPP ppp-102-pm1.wiza Thu Nov 14 23:18:00 - still logged in
    user S17 PPP ppp-115-pm1.wiza Thu Nov 14 07:45:00 - still logged in
    user S-1 0.0.0.0 Sat Aug 10 15:50:03 - still logged in
    user S23 PPP ppp-103-pm1.wiza Fri Nov 15 00:13:53 - still logged in
    user S12 PPP ppp-111-pm1.wiza Wed Nov 13 16:58:12 - still logged in
    ¡¡¡¡Õâ¸öÃüÁîÄÜÏÔʾÓû§µÄ״̬¡£¸ÃÃüÁîÊǽ¨Á¢ÔÚ¿Í»§/·þÎñÄ£ÐÍÖ®Éϵġ£Óû§Í¨¹ý¿Í»§¶ËÈí¼þÏò·þÎñÆ÷ÇëÇóÐÅÏ¢£¬È»ºó½âÊÍÕâЩÐÅÏ¢£¬Ìṩ¸øÓû§¡£ÔÚ·þÎñÆ÷ÉÏÒ»°ãÔËÐÐÒ»¸ö½Ð×öfingerdµÄ³ÌÐò£¬¸ù¾Ý·þÎñÆ÷µÄ»úÆ÷µÄÅäÖã¬ÄÜÏò¿Í»§ÌṩijЩÐÅÏ¢¡£Èç¹û¿¼Âǵ½±£»¤ÕâЩ¸öÈËÐÅÏ¢µÄ»°£¬ÓпÉÄÜÐí¶à·þÎñÆ÷²»ÌṩÕâ¸ö·þÎñ£¬»òÕßÖ»ÌṩһЩÎ޹صÄÐÅÏ¢¡£

    hostÃüÁî
    ¡¡¡¡hostÊÇÒ»¸öUnixÃüÁËüµÄ¹¦Äܺͱê×¼µÄnslookup²éѯһÑù¡£Î¨Ò»µÄÇø±ðÊÇhostÃüÁî±È½ÏÈÝÒ×Àí½â¡£hostÃüÁîµÄΣÏÕÐÔÏ൱´ó£¬ÏÂÃæ¾Ù¸öʹÓÃʵÀý£¬ÑÝʾһ´Î¶Ôbu.eduµÄhost²éѯ¡£
    host -l -v -t any bu.edu
    ¡¡¡¡Õâ¸öÃüÁîµÄÖ´Ðнá¹ûËùµÃµ½µÄÐÅϢʮ·Ö¶à£¬°üÀ¨²Ù×÷ϵͳ£¬»úÆ÷ºÍÍøÂçµÄºÜ¶àÊý¾Ý¡£ÏÈ¿´Ò»Ï»ù±¾ÐÅÏ¢£º
    Found 1 addresses for BU.EDU
    Found 1 addresses for RS0.INTERNIC.NET
    Found 1 addresses for SOFTWARE.BU.EDU
    Found 5 addresses for RS.INTERNIC.NET
    Found 1 addresses for NSEGC.BU.EDU
    Trying 128.197.27.7
    bu.edu 86400 IN SOA BU.EDU HOSTMASTER.BU.EDU(
    961112121 ;serial (version)
    900 ;refresh period
    900 ;retry refresh this often
    604800 ;expiration period
    86400 ;minimum TTL
    )
    bu.edu 86400 IN NS SOFTWARE.BU.EDU
    bu.edu 86400 IN NS RS.INTERNIC.NET
    bu.edu 86400 IN NS NSEGC.BU.EDU
    bu.edu 86400 IN A 128.197.27.7

    ¡¡¡¡ÕâЩ±¾Éí²¢Ã»ÓÐΣÏÕ£¬Ö»ÊÇһЩ»úÆ÷ºÍËüÃǵÄDNS·þÎñÆ÷¡£ÕâЩÐÅÏ¢¿ÉÒÔÓÃWHOIS»òÔÚ×¢²áÓòÃûµÄÕ¾µãÖмìË÷µ½¡£µ«¿´¿´ÏÂÃ漸ÐÐÐÅÏ¢£º
    bu.edu 86400 IN HINFO SUN-SPARCSTATION-10/41 UNIX
    PPP-77-25.bu.edu 86400 IN A 128.197.7.237
    PPP-77-25.bu.edu 86400 IN HINFO PPP-HOST PPP-SW
    PPP-77-26.bu.edu 86400 IN A 128.197.7.238
    PPP-77-26.bu.edu 86400 IN HINFO PPP-HOST PPP-SW
    ODIE.bu.edu 86400 IN A 128.197.10.52
    ODIE.bu.edu 86400 IN MX 10 CS.BU.EDU
    ODIE.bu.edu 86400 IN HINFO DEC-ALPHA-3000/300LX OSF1

    ´ÓÕâÀÎÒÃÇÂíÉϾͷ¢ÏÖһ̨EDC AlphaÔËÐеÄÊÇOSF1²Ù×÷ϵͳ¡£ÔÚ¿´¿´£º
    STRAUSS.bu.edu 86400 IN HINFO PC-PENTIUM DOS/WINDOWS
    BURULLUS.bu.edu 86400 IN HINFO SUN-3/50 UNIX (Ouch)
    GEORGETOWN.bu.edu 86400 IN HINFO MACINTOSH MAC-OS
    CHEEZWIZ.bu.edu 86400 IN HINFO SGI-INDIGO-2 UNIX
    POLLUX.bu.edu 86400 IN HINFO SUN-4/20-SPARCSTATION-SLC UNIX
    SFA109-PC201.bu.edu 86400 IN HINFO PC MS-DOS/WINDOWS
    UH-PC002-CT.bu.edu 86400 IN HINFO PC-CLONE MS-DOS
    SOFTWARE.bu.edu 86400 IN HINFO SUN-SPARCSTATION-10/30 UNIX
    CABMAC.bu.edu 86400 IN HINFO MACINTOSH MAC-OS
    VIDUAL.bu.edu 86400 IN HINFO SGI-INDY IRIX
    KIOSK-GB.bu.edu 86400 IN HINFO GATORBOX GATORWARE
    CLARINET.bu.edu 86400 IN HINFO VISUAL-X-19-TURBO X-SERVER
    DUNCAN.bu.edu 86400 IN HINFO DEC-ALPHA-3000/400 OSF1
    MILHOUSE.bu.edu 86400 IN HINFO VAXSTATION-II/GPX UNIX
    PSY81-PC150.bu.edu 86400 IN HINFO PC WINDOWS-95
    BUPHYC.bu.edu 86400 IN HINFO VAX-4000/300 OpenVMS

    ¡¡¡¡¿É¼û£¬ÈκÎÈ˶¼ÄÜͨ¹ýÔÚÃüÁîÐÐÀï¼üÈëÒ»¸öÃüÁ¾ÍÄÜÊÕ¼¯µ½Ò»¸öÓòÀïµÄËùÓмÆËã»úµÄÖØÒªÐÅÏ¢¡£¶øÇÒÖ»»¯ÁË3Ãëʱ¼ä¡£
    ¡¡¡¡ÎÒÃÇÀûÓÃÉÏÊöÓÐÓõÄÍøÂçÃüÁ¿ÉÒÔÊÕ¼¯µ½Ðí¶àÓÐÓõÄÐÅÏ¢£¬±È·½Ò»¸öÓòÀïµÄÃû×Ö·þÎñÆ÷µÄµØÖ·£¬Ò»Ì¨¼ÆËã»úÉϵÄÓû§Ãû£¬Ò»Ì¨·þÎñÆ÷ÉÏÕýÔÚÔËÐÐʲô·þÎñ£¬Õâ¸ö·þÎñÊÇÄĸöÈí¼þÌṩµÄ£¬¼ÆËã»úÉÏÔËÐеÄÊÇʲô²Ù×÷ϵͳ¡£
    ¡¡¡¡Èç¹ûÄãÖªµÀÄ¿±ê¼ÆËã»úÉÏÔËÐеIJÙ×÷ϵͳºÍ·þÎñÓ¦ÓóÌÐòºó£¬¾ÍÄÜÀûÓÃÒѾ­·¢ÏÖµÄËûÃǵÄ©¶´À´½øÐй¥»÷¡£Èç¹ûÄ¿±ê¼ÆËã»úµÄÍøÂç¹ÜÀíԱûÓжÔÕâЩ©¶´¼°Ê±ÐÞ²¹µÄ»°£¬ÈëÇÖÕßÄÜÇá¶øÒ׾ٵĴ³Èë¸Ãϵͳ£¬»ñµÃ¹ÜÀíԱȨÏÞ£¬²¢ÁôϺóÃÅ¡£
    ¡¡¡¡Èç¹ûÈëÇÖÕߵõ½Ä¿±ê¼ÆËã»úÉϵÄÓû§Ãûºó£¬ÄÜʹÓÿÚÁîÆƽâÈí¼þ£¬¶à´ÎÊÔͼµÇ¼Ŀ±ê¼ÆËã»ú¡£¾­¹ý³¢ÊԺ󣬾ÍÓпÉÄܽøÈëÄ¿±ê¼ÆËã»ú¡£µÃµ½ÁËÓû§Ãû£¬¾ÍµÈÓڵõ½ÁËÒ»°ëµÄ½øÈëȨÏÞ£¬Ê£ÏµÄÖ»ÊÇʹÓÃÈí¼þ½øÐй¥»÷¶øÒÑ¡£
    µÚ¶þ½Ú¡¡¶Ë¿ÚɨÃèÆ÷Ô´³ÌÐò
    ʲôÊÇɨÃèÆ÷
    ¡¡¡¡É¨ÃèÆ÷ÊÇÒ»ÖÖ×Ô¶¯¼ì²âÔ¶³Ì»ò±¾µØÖ÷»ú°²È«ÐÔÈõµãµÄ³ÌÐò£¬Í¨¹ýʹÓÃɨÃèÆ÷Äã¿ÉÒ»²»ÁôºÛ¼£µÄ·¢ÏÖÔ¶³Ì·þÎñÆ÷µÄ¸÷ÖÖTCP¶Ë¿ÚµÄ·ÖÅä¼°ÌṩµÄ·þÎñºÍËüÃǵÄÈí¼þ°æ±¾£¡Õâ¾ÍÄÜÈÃÎÒÃǼä½ÓµÄ»òÖ±¹ÛµÄÁ˽⵽Զ³ÌÖ÷»úËù´æÔڵݲȫÎÊÌâ¡£

    ¹¤×÷Ô­Àí
    ¡¡¡¡É¨ÃèÆ÷ͨ¹ýÑ¡ÓÃÔ¶³ÌTCP/IP²»Í¬µÄ¶Ë¿ÚµÄ·þÎñ£¬²¢¼Ç¼Ŀ±ê¸øÓèµÄ»Ø´ð£¬Í¨¹ýÕâÖÖ·½·¨£¬¿ÉÒÔËѼ¯µ½ºÜ¶à¹ØÓÚÄ¿±êÖ÷»úµÄ¸÷ÖÖÓÐÓõÄÐÅÏ¢£¨±ÈÈ磺ÊÇ·ñÄÜÓÃÄäÃûµÇ½£¡ÊÇ·ñÓпÉдµÄFTPĿ¼£¬ÊÇ·ñÄÜÓÃTELNET£¬HTTPDÊÇÓÃROOT»¹ÊÇnobadyÔÚÅÜ£¡£©

    ɨÃèÆ÷ÄܸÉʲô£¿
    ¡¡¡¡É¨ÃèÆ÷²¢²»ÊÇÒ»¸öÖ±½ÓµÄ¹¥»÷ÍøÂ究´µÄ³ÌÐò£¬Ëü½ö½öÄÜ°ïÖúÎÒÃÇ·¢ÏÖÄ¿±ê»úµÄijЩÄÚÔÚµÄÈõµã¡£Ò»¸öºÃµÄɨÃèÆ÷ÄܶÔËüµÃµ½µÄÊý¾Ý½øÐзÖÎö£¬°ïÖúÎÒÃDzéÕÒÄ¿±êÖ÷»úµÄ©¶´¡£µ«Ëü²»»áÌṩ½øÈëÒ»¸öϵͳµÄÏêϸ²½Öè¡£
    ¡¡¡¡É¨ÃèÆ÷Ó¦¸ÃÓÐÈýÏÄÜ£º·¢ÏÖÒ»¸öÖ÷»ú»òÍøÂçµÄÄÜÁ¦£»Ò»µ©·¢ÏÖһ̨Ö÷»ú£¬Óз¢ÏÖʲô·þÎñÕýÔËÐÐÔÚÕą̂Ö÷»úÉϵÄÄÜÁ¦£»Í¨¹ý²âÊÔÕâЩ·þÎñ£¬·¢ÏÖ©¶´µÄÄÜÁ¦¡£
    ¡¡¡¡±àдɨÃèÆ÷³ÌÐò±ØÐëÒªºÜ¶àTCP/IP³ÌÐò±àдºÍC, PerlºÍ»òSHELLÓïÑÔµÄ֪ʶ¡£ÐèҪһЩSocket±à³ÌµÄ±³¾°£¬Ò»ÖÖÔÚ¿ª·¢¿Í»§/·þÎñÓ¦ÓóÌÐòµÄ·½·¨¡£¿ª·¢Ò»¸öɨÃèÆ÷ÊÇÒ»¸öÐÛÐIJª²ªµÄÏîÄ¿£¬Í¨³£ÄÜʹ³ÌÐòÔ±¸Ðµ½ºÜÂúÒâ¡£
    ¡¡¡¡ÏÂÃæ¶Ô³£ÓõĶ˿ÚɨÃè¼¼Êõ×öÒ»¸ö½éÉÜ¡£
    TCP connect() ɨÃè
    ¡¡¡¡ÕâÊÇ×î»ù±¾µÄTCPɨÃè¡£²Ù×÷ϵͳÌṩµÄconnect()ϵͳµ÷Óã¬ÓÃÀ´Óëÿһ¸ö¸ÐÐËȤµÄÄ¿±ê¼ÆËã»úµÄ¶Ë¿Ú½øÐÐÁ¬½Ó¡£Èç¹û¶Ë¿Ú´¦ÓÚÕìÌý״̬£¬ÄÇôconnect()¾ÍÄܳɹ¦¡£·ñÔò£¬Õâ¸ö¶Ë¿ÚÊDz»ÄÜÓõģ¬¼´Ã»ÓÐÌṩ·þÎñ¡£Õâ¸ö¼¼ÊõµÄÒ»¸ö×î´óµÄÓŵãÊÇ£¬Äã²»ÐèÒªÈκÎȨÏÞ¡£ÏµÍ³ÖеÄÈκÎÓû§¶¼ÓÐȨÀûʹÓÃÕâ¸öµ÷Óá£ÁíÒ»¸öºÃ´¦¾ÍÊÇËٶȡ£Èç¹û¶Ôÿ¸öÄ¿±ê¶Ë¿ÚÒÔÏßÐԵķ½Ê½£¬Ê¹Óõ¥¶ÀµÄconnect()µ÷Óã¬ÄÇô½«»á»¨·ÑÏ൱³¤µÄʱ¼ä£¬Äã¿ÉÒÔͨ¹ýͬʱ´ò¿ª¶à¸öÌ×½Ó×Ö£¬´Ó¶ø¼ÓËÙɨÃ衣ʹÓ÷Ç×èÈûI/OÔÊÐíÄãÉèÖÃÒ»¸öµÍµÄʱ¼äÓþ¡ÖÜÆÚ£¬Í¬Ê±¹Û²ì¶à¸öÌ×½Ó×Ö¡£µ«ÕâÖÖ·½·¨µÄȱµãÊǺÜÈÝÒ×±»·¢¾õ£¬²¢ÇÒ±»¹ýÂ˵ô¡£Ä¿±ê¼ÆËã»úµÄlogsÎļþ»áÏÔʾһÁ¬´®µÄÁ¬½ÓºÍÁ¬½ÓÊdzö´íµÄ·þÎñÏûÏ¢£¬²¢ÇÒÄܺܿìµÄʹËü¹Ø±Õ¡£

    TCP SYNɨÃè
    ¡¡¡¡ÕâÖÖ¼¼Êõͨ³£ÈÏΪÊÇ¡°°ë¿ª·Å¡±É¨Ã裬ÕâÊÇÒòΪɨÃè³ÌÐò²»±ØÒª´ò¿ªÒ»¸öÍêÈ«µÄTCPÁ¬½Ó¡£É¨Ãè³ÌÐò·¢Ë͵ÄÊÇÒ»¸öSYNÊý¾Ý°ü£¬ºÃÏó×¼±¸´ò¿ªÒ»¸öʵ¼ÊµÄÁ¬½Ó²¢µÈ´ý·´Ó¦Ò»Ñù£¨²Î¿¼TCPµÄÈý´ÎÎÕÊÖ½¨Á¢Ò»¸öTCPÁ¬½ÓµÄ¹ý³Ì£©¡£Ò»¸öSYN|ACKµÄ·µ»ØÐÅÏ¢±íʾ¶Ë¿Ú´¦ÓÚÕìÌý״̬¡£Ò»¸öRST·µ»Ø£¬±íʾ¶Ë¿ÚûÓд¦ÓÚÕìÌý̬¡£Èç¹ûÊÕµ½Ò»¸öSYN|ACK£¬ÔòɨÃè³ÌÐò±ØÐëÔÙ·¢ËÍÒ»¸öRSTÐźţ¬À´¹Ø±ÕÕâ¸öÁ¬½Ó¹ý³Ì¡£ÕâÖÖɨÃè¼¼ÊõµÄÓŵãÔÚÓÚÒ»°ã²»»áÔÚÄ¿±ê¼ÆËã»úÉÏÁôϼǼ¡£µ«ÕâÖÖ·½·¨µÄÒ»¸öȱµãÊÇ£¬±ØÐëÒªÓÐrootȨÏÞ²ÅÄܽ¨Á¢×Ô¼ºµÄSYNÊý¾Ý°ü¡£

    TCP FIN ɨÃè
    ¡¡¡¡ÓеÄʱºòÓпÉÄÜSYNɨÃ趼²»¹»ÃØÃÜ¡£Ò»Ð©·À»ðǽºÍ°ü¹ýÂËÆ÷»á¶ÔһЩָ¶¨µÄ¶Ë¿Ú½øÐмàÊÓ£¬ÓеijÌÐòÄܼì²âµ½ÕâЩɨÃè¡£Ïà·´£¬FINÊý¾Ý°ü¿ÉÄÜ»áûÓÐÈκÎÂé·³µÄͨ¹ý¡£ÕâÖÖɨÃè·½·¨µÄ˼ÏëÊǹرյĶ˿ڻáÓÃÊʵ±µÄRSTÀ´»Ø¸´FINÊý¾Ý°ü¡£ÁíÒ»·½Ã棬´ò¿ªµÄ¶Ë¿Ú»áºöÂÔ¶ÔFINÊý¾Ý°üµÄ»Ø¸´¡£ÕâÖÖ·½·¨ºÍϵͳµÄʵÏÖÓÐÒ»¶¨µÄ¹Øϵ¡£ÓеÄϵͳ²»¹Ü¶Ë¿ÚÊÇ·ñ´ò¿ª£¬¶¼»Ø¸´RST£¬ÕâÑù£¬ÕâÖÖɨÃè·½·¨¾Í²»ÊÊÓÃÁË¡£²¢ÇÒÕâÖÖ·½·¨ÔÚÇø·ÖUnixºÍNTʱ£¬ÊÇÊ®·ÖÓÐÓõġ£

    IP¶ÎɨÃè
    ¡¡¡¡ÕâÖÖ²»ÄÜËãÊÇз½·¨£¬Ö»ÊÇÆäËü¼¼ÊõµÄ±ä»¯¡£Ëü²¢²»ÊÇÖ±½Ó·¢ËÍTCP̽²âÊý¾Ý°ü£¬Êǽ«Êý¾Ý°ü·Ö³ÉÁ½¸ö½ÏСµÄIP¶Î¡£ÕâÑù¾Í½«Ò»¸öTCPÍ··Ö³ÉºÃ¼¸¸öÊý¾Ý°ü£¬´Ó¶ø¹ýÂËÆ÷¾ÍºÜÄÑ̽²âµ½¡£µ«±ØÐëСÐÄ¡£Ò»Ð©³ÌÐòÔÚ´¦ÀíÕâЩСÊý¾Ý°üʱ»áÓÐЩÂé·³¡£

    TCP ·´Ïò identɨÃè
    ¡¡¡¡ident ЭÒéÔÊÐí(rfc1413)¿´µ½Í¨¹ýTCPÁ¬½ÓµÄÈκνø³ÌµÄÓµÓÐÕßµÄÓû§Ãû£¬¼´Ê¹Õâ¸öÁ¬½Ó²»ÊÇÓÉÕâ¸ö½ø³Ì¿ªÊ¼µÄ¡£Òò´ËÄãÄÜ£¬¾Ù¸öÀý×Ó£¬Á¬½Óµ½http¶Ë¿Ú£¬È»ºóÓÃidentdÀ´·¢ÏÖ·þÎñÆ÷ÊÇ·ñÕýÔÚÒÔrootȨÏÞÔËÐС£ÕâÖÖ·½·¨Ö»ÄÜÔÚºÍÄ¿±ê¶Ë¿Ú½¨Á¢ÁËÒ»¸öÍêÕûµÄTCPÁ¬½Óºó²ÅÄÜ¿´µ½¡£

    FTP ·µ»Ø¹¥»÷
    ¡¡¡¡FTPЭÒéµÄÒ»¸öÓÐȤµÄÌصãÊÇËüÖ§³Ö´úÀí£¨proxy£©FTPÁ¬½Ó¡£¼´ÈëÇÖÕß¿ÉÒÔ´Ó×Ô¼ºµÄ¼ÆËã»úa.comºÍÄ¿±êÖ÷»útarget.comµÄFTP server-PI(ЭÒé½âÊÍÆ÷)Á¬½Ó£¬½¨Á¢Ò»¸ö¿ØÖÆͨÐÅÁ¬½Ó¡£È»ºó£¬ÇëÇóÕâ¸öserver-PI¼¤»îÒ»¸öÓÐЧµÄserver-DTP(Êý¾Ý´«Êä½ø³Ì)À´¸øInternetÉÏÈκεط½·¢ËÍÎļþ¡£¶ÔÓÚÒ»¸öUser-DTP£¬ÕâÊǸöÍƲâ,¾¡¹ÜRFCÃ÷È·µØ¶¨ÒåÇëÇóÒ»¸ö·þÎñÆ÷·¢ËÍÎļþµ½ÁíÒ»¸ö·þÎñÆ÷ÊÇ¿ÉÒԵġ£µ«ÏÖÔÚÕâ¸ö·½·¨ºÃÏó²»ÐÐÁË¡£Õâ¸öЭÒéµÄȱµãÊÇ¡°ÄÜÓÃÀ´·¢ËͲ»Äܸú×ÙµÄÓʼþºÍÐÂÎÅ£¬¸øÐí¶à·þÎñÆ÷Ôì³É´ò»÷£¬Óþ¡´ÅÅÌ£¬ÆóͼԽ¹ý·À»ðǽ¡±¡£
    ¡¡¡¡ÎÒÃÇÀûÓÃÕâ¸öµÄÄ¿µÄÊÇ´ÓÒ»¸ö´úÀíµÄFTP·þÎñÆ÷À´É¨ÃèTCP¶Ë¿Ú¡£ÕâÑù£¬ÄãÄÜÔÚÒ»¸ö·À»ðǽºóÃæÁ¬½Óµ½Ò»¸öFTP·þÎñÆ÷£¬È»ºóɨÃè¶Ë¿Ú£¨ÕâЩԭÀ´ÓпÉÄܱ»×èÈû£©¡£Èç¹ûFTP·þÎñÆ÷ÔÊÐí´ÓÒ»¸öĿ¼¶ÁдÊý¾Ý£¬Äã¾ÍÄÜ·¢ËÍÈÎÒâµÄÊý¾Ýµ½·¢ÏֵĴò¿ªµÄ¶Ë¿Ú¡£
    ¡¡¡¡¶ÔÓڶ˿ÚɨÃ裬Õâ¸ö¼¼ÊõÊÇʹÓÃPORTÃüÁîÀ´±íʾ±»¶¯µÄUser DTPÕýÔÚÄ¿±ê¼ÆËã»úÉϵÄij¸ö¶Ë¿ÚÕìÌý¡£È»ºóÈëÇÖÕßÊÔͼÓÃLISTÃüÁîÁгöµ±Ç°Ä¿Â¼£¬½á¹ûͨ¹ýServer-DTP·¢ËͳöÈ¥¡£Èç¹ûÄ¿±êÖ÷»úÕýÔÚij¸ö¶Ë¿ÚÕìÌý£¬´«Êä¾Í»á³É¹¦£¨²úÉúÒ»¸ö150»ò226µÄ»ØÓ¦£©¡£·ñÔò£¬»á³öÏÖ\"425 Can\"t build data connection: Connection refused.\"¡£È»ºó£¬Ê¹ÓÃÁíÒ»¸öPORTÃüÁ³¢ÊÔÄ¿±ê¼ÆËã»úÉϵÄÏÂÒ»¸ö¶Ë¿Ú¡£ÕâÖÖ·½·¨µÄÓŵãºÜÃ÷ÏÔ£¬ÄÑÒÔ¸ú×Ù£¬ÄÜ´©¹ý·À»ðǽ¡£Ö÷ҪȱµãÊÇËٶȺÜÂý£¬ÓеÄFTP·þÎñÆ÷×îÖÕÄܵõ½Ò»Ð©ÏßË÷£¬¹Ø±Õ´úÀí¹¦ÄÜ¡£

    ÕâÖÖ·½·¨Äܳɹ¦µÄÇé¾°£º
    220 xxxxxxx.com FTP server (Version wu-2.4(3) Wed Dec 14 ...) ready.
    220 xxx.xxx.xxx.edu FTP server ready.
    220 xx.Telcom.xxxx.EDU FTP server (Version wu-2.4(3) Tue Jun 11 ...) ready.
    220 lem FTP server (SunOS 4.1) ready.
    220 xxx.xxx.es FTP server (Version wu-2.4(11) Sat Apr 27 ...) ready.
    220 elios FTP server (SunOS 4.1) ready

    ÕâÖÖ·½·¨²»Äܳɹ¦µÄÇé¾°£º
    220 wcarchive.cdrom.com FTP server (Version DG-2.0.39 Sun May 4 ...) ready.
    220 xxx.xx.xxxxx.EDU Version wu-2.4.2-academ[BETA-12](1) Fri Feb 7
    220 ftp Microsoft FTP Service (Version 3.0).
    220 xxx FTP server (Version wu-2.4.2-academ[BETA-11](1) Tue Sep 3 ...) ready.
    220 xxx.unc.edu FTP server (Version wu-2.4.2-academ[BETA-13](6) ...) ready.

    UDP ICMP¶Ë¿Ú²»Äܵ½´ïɨÃè
    ¡¡¡¡ÕâÖÖ·½·¨ÓëÉÏÃ漸ÖÖ·½·¨µÄ²»Í¬Ö®´¦ÔÚÓÚʹÓõÄÊÇUDPЭÒé¡£ÓÉÓÚÕâ¸öЭÒéºÜ¼òµ¥£¬ËùÒÔɨÃè±äµÃÏà¶Ô±È½ÏÀ§ÄÑ¡£ÕâÊÇÓÉÓÚ´ò¿ªµÄ¶Ë¿Ú¶ÔɨÃè̽²â²¢²»·¢ËÍÒ»¸öÈ·ÈÏ£¬¹Ø±ÕµÄ¶Ë¿ÚÒ²²¢²»ÐèÒª·¢ËÍÒ»¸ö´íÎóÊý¾Ý°ü¡£ÐÒÔ˵ÄÊÇ£¬Ðí¶àÖ÷»úÔÚÄãÏòÒ»¸öδ´ò¿ªµÄUDP¶Ë¿Ú·¢ËÍÒ»¸öÊý¾Ý°üʱ£¬»á·µ»ØÒ»¸öICMP_PORT_UNREACH´íÎó¡£ÕâÑùÄã¾ÍÄÜ·¢ÏÖÄĸö¶Ë¿ÚÊǹرյġ£UDPºÍICMP´íÎ󶼲»±£Ö¤Äܵ½´ï£¬Òò´ËÕâÖÖɨÃèÆ÷±ØÐ뻹ʵÏÖÔÚÒ»¸ö°ü¿´ÉÏÈ¥ÊǶªÊ§µÄʱºòÄÜÖØд«Êä¡£ÕâÖÖɨÃè·½·¨ÊǺÜÂýµÄ£¬ÒòΪRFC¶ÔICMP´íÎóÏûÏ¢µÄ²úÉúËÙÂÊ×öÁ˹涨¡£Í¬Ñù£¬ÕâÖÖɨÃè·½·¨ÐèÒª¾ßÓÐrootȨÏÞ¡£

    UDP recvfrom()ºÍwrite() ɨÃè
    ¡¡¡¡µ±·ÇrootÓû§²»ÄÜÖ±½Ó¶Áµ½¶Ë¿Ú²»Äܵ½´ï´íÎóʱ£¬LinuxÄܼä½ÓµØÔÚËüÃǵ½´ïʱ֪ͨÓû§¡£±ÈÈ磬¶ÔÒ»¸ö¹Ø±ÕµÄ¶Ë¿ÚµÄµÚ¶þ¸öwrite()µ÷Óý«Ê§°Ü¡£ÔÚ·Ç×èÈûµÄUDPÌ×½Ó×ÖÉϵ÷ÓÃrecvfrom()ʱ£¬Èç¹ûICMP³ö´í»¹Ã»Óе½´ïʱ»Ø·µ»ØEAGAIN-ÖØÊÔ¡£Èç¹ûICMPµ½´ïʱ£¬·µ»ØECONNREFUSED-Á¬½Ó±»¾Ü¾ø¡£Õâ¾ÍÊÇÓÃÀ´²é¿´¶Ë¿ÚÊÇ·ñ´ò¿ªµÄ¼¼Êõ¡£


    ICMP echoɨÃè
    ¡¡¡¡Õâ²¢²»ÊÇÕæÕýÒâÒåÉϵÄɨÃè¡£µ«ÓÐʱͨ¹ýping£¬ÔÚÅжÏÔÚÒ»¸öÍøÂçÉÏÖ÷»úÊÇ·ñ¿ª»úʱ·Ç³£ÓÐÓá£
    ¡¡¡¡Ç°Ã漸Õ»ù´¡ÖªÊ¶½éÉÜÒѾ­ÎªÕâÀïµÄ±à³Ì×÷ÁË×¼±¸ÁË¡£
    ¡¡¡¡ÏÂÃæÊÇÒ»¸ö¶Ë¿ÚɨÃèÆ÷µÄÔ´³ÌÐò£¬¹¦ÄÜÏ൱µÄ¼òµ¥£¬Ò»¸öµäÐ͵ÄTCP connect()ɨÃ衣ûÓжԷµ»ØµÄÊý¾Ý½øÐзÖÎö¡£
    #include < stdio.h>
    #include < sys/socket.h>
    #include < netinet/in.h>
    #include < errno.h>
    #include < netdb.h>
    #include < signal.h>

    int main(int argc, char **argv)
    {
    int probeport = 0;
    struct hostent *host;
    int err, i, net;
    struct sockaddr_in sa;

    if (argc != 2) {
    printf(\"Ó÷¨: %s hostname\\n\", argv[0]);
    exit(1);
    }

    for (i = 1; i < 1024; i++) { //ÕâÀïÓе㲻ÊǺܺ㬿ÉÒÔ½«Ö÷»úµØÖ··ÅÔÚÑ­»·Íâ
    strncpy((char *)&sa, \"\", sizeof sa);
    sa.sin_family = AF_INET;
    if (isdigit(*argv[1]))
    sa.sin_addr.s_addr = inet_addr(argv[1]);
    else if ((host = gethostbyname(argv[1])) != 0)
    strncpy((char *)&sa.sin_addr, (char *)host->h_addr, sizeof sa.sin_addr);
    else {
    herror(argv[1]);
    exit(2);
    }
    sa.sin_port = htons(i);
    net = socket(AF_INET, SOCK_STREAM, 0);
    if (net < 0) {
    perror(\"\\nsocket\");
    exit(2);
    }
    err = connect(net, (struct sockaddr *) &sa, sizeof sa);
    if (err < 0) {
    printf(\"%s %-5d %s\\r\", argv[1], i, strerror(errno));
    fflush(stdout);
    } else {
    printf(\"%s %-5d accepted. \\n\", argv[1], i);
    if (shutdown(net, 2) < 0) {
    perror(\"\\nshutdown\");
    exit(2);
    }
    }
    close(net);
    }
    printf(\" \\r\");
    fflush(stdout);
    return (0);
    }
    ÏÂÃæÕâ¸öÓÖÊÇÒ»¸ö¶Ë¿ÚÆ÷£º
    #include < stdio.h>
    #include < sys/types.h>
    #include < sys/socket.h>
    #include \"netdb.h\"
    struct hostent *gethostbyaddr();
    void bad_addr();
    main(argc, argv)
    int argc;
    char *argv[];
    {
    char addr[4];
    int i, j,
    a0, a1, a2, a3,
    c,
    classB, classC, single, hex;
    char *fmt = \"%d.%d.%d\";
    char **ptr;
    struct hostent *host;
    extern char *optarg;
    classB = classC = single = hex = 0;
    while((c = getopt(argc,argv,\"bcsx\")) != EOF) {
    switch(c) {
    case \"b\":
    classB++;
    break;
    case \"c\":
    classC++;
    break;
    case \"s\":
    single++;
    break;
    case \"x\":
    hex++;
    break;
    }
    }
    if(classB == 0 && classC == 0 && single == 0) {
    fprintf(stderr, \"usage: %s [-b||-c||-s] [-x] xxx.xxx[.xxx[.xxx]]\\n\", argv[0]);
    exit(1);
    }
    if(classB)
    if(hex) {
    fmt = \"%x.%x\";
    sscanf(argv[3], fmt, &a0, &a1);
    } else {
    fmt = \"%d.%d\";
    sscanf(argv[2], fmt, &a0, &a1);
    }
    else if(classC)
    if(hex) {
    fmt = \"%x.%x.%x\";
    sscanf(argv[3], fmt, &a0, &a1, &a2);
    } else {
    fmt = \"%d.%d.%d\";
    sscanf(argv[2], fmt, &a0, &a1, &a2);
    }
    else if(single)
    if(hex) {
    fmt = \"%x.%x.%x.%x\";
    sscanf(argv[3], fmt, &a0, &a1, &a2, &a3);
    } else {
    fmt = \"%d.%d.%d.%d\";
    sscanf(argv[2], fmt, &a0, &a1, &a2, &a3);
    }
    sscanf(argv[1], fmt, &a0, &a1, &a2);
    addr[0] = (unsigned char)a0;
    addr[1] = (unsigned char)a1;
    if(a0>255||a0< 0)
    bad_addr(a0);
    if(a1>255||a1< 0)
    bad_addr(a1);
    if(classB) {
    if(hex)
    printf(\"Converting address from hex. (%x.%x)\\n\", a0, a1);
    printf(\"Scanning Class B network %d.%d...\\n\", a0, a1);
    while(j!=256) {
    a2=j;
    addr[2] = (unsigned char)a2;
    jmpC:
    if(classC)
    if(hex)
    printf(\"Converting address from hex. (%x.%x.%x)\\n\", a0, a1, a2);
    printf(\"Scanning Class C network %d.%d.%d...\\n\", a0, a1, a2);
    while(i!=256) {
    a3=i;
    addr[3] = (unsigned char)a3;
    jmpS:
    if ((host = gethostbyaddr(addr, 4, AF_INET)) != NULL) {
    printf(\"%d.%d.%d.%d => %s\\n\", a0, a1, a2, a3, host->h_name);
    ptr = host->h_aliases;
    while (*ptr != NULL) {
    printf(\"%d.%d.%d.%d => %s (alias)\\n\", a0, a1, a2, a3, *ptr);
    ptr++;
    }
    }
    if(single)
    exit(0);
    i++;
    }
    if(classC)
    exit(0);
    j++;
    }
    } else if(classC) {
    addr[2] = (unsigned char)a2;
    if(a2>255||a2< 0)
    bad_addr(a2);
    goto jmpC;
    } else if(single) {
    addr[2] = (unsigned char)a2;
    addr[3] = (unsigned char)a3;
    if(a2>255||a2< 0)
    bad_addr(a2);
    if(a3>255||a3< 0)
    bad_addr(a3);
    goto jmpS;
    }
    exit(0);
    }
    void
    bad_addr(addr)
    int *addr;
    {
    printf(\"Value %d is not valid.\\n\", addr);
    exit(0);
    }
    ¡¡

    δÍê´ýÐø
    ·¢²¼ÈË:netbull À´×Ô:JJµÄLinuxÊÀ½ç