#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. RedisCluster linux下批量删除 key

    Redis Cluster linux下批量删除键 说明 使用时不支持传入参数 , 如 redis_batch_del.sh , 因为在linux下 会自动将 * 解析为当前目录下所有文件名, 目前还 ...

  2. 从头学pytorch(二十):残差网络resnet

    残差网络ResNet resnet是何凯明大神在2015年提出的.并且获得了当年的ImageNet比赛的冠军. 残差网络具有里程碑的意义,为以后的网络设计提出了一个新的思路. googlenet的思路 ...

  3. cogs 1963. [HAOI 2015] 树上操作 树链剖分+线段树

    1963. [HAOI 2015] 树上操作 ★★★☆   输入文件:haoi2015_t2.in   输出文件:haoi2015_t2.out   简单对比时间限制:1 s   内存限制:256 M ...

  4. 读取配置文件,appsettings.json和注入ICO

    https://www.cnblogs.com/knowledgesea/p/7079880.html 引入Nuget的两个类库 Microsoft.Extensions.Configuration ...

  5. flask路由要点

    1.参数类型intfloatstringpath uuid<any(a, b): an> 枚举, an必须是any中的值2.多个url指向一个视图函数是可行的3.url_for('蓝图名字 ...

  6. idea命令行、撤销commit

    原文地址:https://blog.csdn.net/chzphoenix/article/details/38090349 近期在使用git,最开始在idea界面操作,后来要求用命令行.刚开始还不是 ...

  7. typescript step by step interface class

  8. 月经贴 】 Csharp in depth

    让你 真正 喜欢 上 C# 编译器 准备 为你 上演 的 奇迹. C# 3 中 相对 乏味 的 一些 特性 开始.   自动 实现 的 属性 和 简化 的 初始化, 有一个 私 有的 无 参 构造 函 ...

  9. linux--->PHP常用模块解析

    PHP常用模块解析 php-gd :GD库是php处理图形的扩展库,GD库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片,也可以给图片加水印 php-ldap :LDAP是轻量 ...

  10. Tomcat项目启动常见错误以及原因,持续更新.........

    一 Context initialization failed 错误截图: 原因: jdk版本与项目不对应,可重新设置项目jdk和ide编译的jdk即可