#include <stdlib.h>
#include <stdio.h> #include <pcap.h> #pragma comment(lib, "packet.lib")
#pragma comment(lib, "wpcap.lib") int main(int argc, char **argv)
{
pcap_t *fp;
char errbuf[PCAP_ERRBUF_SIZE];
u_char packet[];
int i; /* Check the validity of the command line */
if (argc != )
{
printf("usage: %s interface", argv[]);
return ;
} /* Open the adapter */
if ((fp = pcap_open_live(argv[], // name of the device
, // portion of the packet to capture. It doesn't matter in this case
, // promiscuous mode (nonzero means promiscuous)
, // read timeout
errbuf // error buffer
)) == NULL)
{
fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n", argv[]);
return ;
} /* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */
packet[]= 0xbd;
packet[]= 0xbd;
packet[]= 0xbd;
packet[]= 0xbd;
packet[]= 0xbd;
packet[]= 0xbd; /* set mac source to 2:2:2:2:2:2 */
packet[]= 0x00;
packet[]= 0x0e;
packet[]= 0xc6;
packet[]= 0xd6;
packet[]= 0x80;
packet[]= 0x6c; // Eth type
packet[] = 0x86;
packet[] = 0xdd; //IPv6 header
packet[] = 0x60;
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00;
packet[] = 0x24;
packet[] = 0x3a; //next header
packet[] = 0x08; packet[] = 0xfe; // source addr
packet[] = 0x80;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x8c;
packet[] = 0x79;
packet[] = 0xe4;
packet[] = 0xf9; packet[] = 0xf5;
packet[] = 0xa3;
packet[] = 0xe5;
packet[] = 0xeb; packet[] = 0xff; // dest addr
packet[] = 0x02;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x01; packet[] = 0x86; // icmp v6 header type
packet[] = 0x00; // code
packet[] = 0xe6; // check sum
packet[] = 0x43; packet[] = 0x08;
packet[] = 0x00;
packet[] = 0x01; // router lifetime
packet[] = 0x10; packet[] = 0x00; // reachable time
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x00; // retrans timer
packet[] = 0x00;
packet[] = 0x00;
packet[] = 0x00; packet[] = 0x03; // Option-type
packet[] = 0x04; // Option-length
packet[] = 0x40; // Option-prefix length
packet[] = 0xc0; // Option-L A packet[] = 0xff; // Option-valid lifetime
packet[] = 0xff; // Option-valid lifetime
packet[] = 0xff; // Option-valid lifetime
packet[] = 0xff; // Option-valid lifetime packet[] = 0xff; // Option-prefered lifetime
packet[] = 0xff; // Option-prefered lifetime
packet[] = 0xff; // Option-prefered lifetime
packet[] = 0xff; // Option-prefered lifetime packet[] = 0x00; // Option-reserved
packet[] = 0x00; // Option-reserved
packet[] = 0x00; // Option-reserved
packet[] = 0x00; // Option-reserved packet[] = 0xfc; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0xf8; // Option-prefix
packet[] = 0x02; // Option-prefix packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix
packet[] = 0x00; // Option-prefix packet[] = 0x2c; // crc
packet[] = 0x6a; // crc
packet[] = 0x46; // crc
packet[] = 0xb5; // crc ///* Fill the rest of the packet */
//for(i=102;i<200;i++)
//{
// packet[i]= (u_char)i;
//} /* Send down the packet */
if (pcap_sendpacket(fp, // Adapter
packet, // buffer with the packet
// size
) != )
{
fprintf(stderr,"\nError sending the packet: %s\n", pcap_geterr(fp));
return ;
} pcap_close(fp);
return ;
}

调用winpcap发送路由器公告的更多相关文章

  1. sqlserver能否调用webservice发送短信呢?

    上班的时候突然有一个想法,sqlserver能否调用webservice发送短信呢? 经过查找资料,终于找到了解决办法,现将步骤贴到下面: (1)开启sqlserver组件功能,如果不开启这个组件功能 ...

  2. android 中调用接口发送短信

    android中可以通过两种方式发送短信 第一:调用系统短信接口直接发送短信:主要代码如下: //直接调用短信接口发短信 SmsManager smsManager = SmsManager.getD ...

  3. 使用nodejs调用微信发送红包

    前置条件:申请微信发送红包的账户及其权限 依赖 blueimg-md5和 xmlreader 库 /common/weixin.js 源码 /** * Created by chent696 on 2 ...

  4. C#调用Mail发送QQ邮件

    需要用到: 1.System.Net.Mail; 2.QQ邮箱的POP3/SMTP服务码 QQ邮箱的POP3/SMTP服务码获取方法: 1.打开qq邮箱: 2.进入设置页面-->账户:(往下翻) ...

  5. php调用微信发送自定义模版接口

     function sendWechatmodel($openid,$data,$go_url)//接受消息的用户openid,发送的消息,点击详情跳转的url        {           ...

  6. winpcap 发送接收速率

    总体情况: 在不修改winpcap源码的情况下,发包.收包最大速率3包/ms. 收包几个api的速率: 1. m_fp = pcap_open_live(adapter->name, 65536 ...

  7. iOS调用系统发送短信和邮件分享

    //发送邮件 -(void)sendMail:(NSString*)subject content:(NSString*)content{ MFMailComposeViewController*co ...

  8. Android调用Webservice发送文件

    一服务器端C#这里有三个上传方法1.uploadFile( byte []bs, String fileName); PC机操作是没有问题2. uploadImage(String filename, ...

  9. 一次ajax调用,发送了两次请求(一次为请求方法为option,一次为正常请求)

    在项目了开发时遇见一个奇怪的现象,就是我在js里面发送一次ajax请求,在浏览器network那边查询到的却是发送了两次请求,第一次的Request Method参数为OPTIONS,第二次的Requ ...

随机推荐

  1. 使用ABAP Data Validator验证数据有效性

    在日常的开发过程中,我们常常要处理不同来源的数据.数据可能来自不可靠的外部系统.不可靠的用户输入和甚至设计有误的数据库表,因此,对数据有效性进行验证是必要的工作. 开源工具ABAP Data Vali ...

  2. matplotlib 直方图

    一.特点 数据必须是原始数据不能经过处理,数据连续型,显示一组或多组分布数据 histogram 直方图 normed 定额 二.核心 hist(x, bins=None, normed=None) ...

  3. Java单体应用 - Markdown - 01.简介

    原文地址:http://www.work100.net/training/monolithic-markdown.html 更多教程:光束云 - 免费课程 简介 序号 文内章节 视频 1 概述 2 特 ...

  4. C语言进阶——结构体,联合,枚举

    ----------------------------------------------------------我是一条划分线----------------------------------- ...

  5. JUC中的原子操作类及其原理

    昨天简单的看了看Unsafe的使用,今天我们看看JUC中的原子类是怎么使用Unsafe的,以及分析一下其中的原理! 一.简单使用AtomicLong 还记的上一篇博客中我们使用了volatile关键字 ...

  6. 正斜杠(" / ")和反斜杠(" \ ")的区别

    反斜杠“\”是电脑出现了之后为了表示程序设计里的特殊含义才发明的专用标点.所以除了程序设计领域外,任何地方都不应该使用反斜杠. 如何区分正反斜杠 英语:"/" 英文是forward ...

  7. mybatis 执行流程以及初用错误总结

    mappper 配置文件  头文件: 1.   <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" &q ...

  8. 异常处理 | manual close is not allowed over a Spring managed SqlSession

    背景: 今天启动一个老项目,控制台打印出以下异常,大概是说在Spring托管的SqlSession上不允许手动关闭: java.lang.UnsupportedOperationException: ...

  9. 集合详解之 Collection

    集合详解之 Collection 先来看看集合的继承关系图,如下图所示: 其中: 外框为虚线的表示接口,边框为实线的表示类: 箭头为虚线的表示实现了接口,箭头为实线的表示继承了类. 为了方便理解,我隐 ...

  10. 重磅!K8S 1.18版本将内置支持SideCar容器。

    作者:justmine 头条号:大数据与云原生 微信公众号:大数据与云原生 创作不易,在满足创作共用版权协议的基础上可以转载,但请以超链接形式注明出处. 为了方便阅读,微信公众号已按分类排版,后续的文 ...