#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. cogs 397. [USACO Oct09] 热浪 Dijkstra

    397. [USACO Oct09] 热浪 ★☆   输入文件:heatwvx.in   输出文件:heatwvx.out   简单对比时间限制:1 s   内存限制:128 MB 德克薩斯純樸的民眾 ...

  2. Mixing Milk 混合牛奶 USACO 贪心

    1009: 1.3.1 Mixing Milk 混合牛奶 时间限制: 1 Sec  内存限制: 128 MB提交: 9  解决: 9[提交] [状态] [讨论版] [命题人:外部导入] 题目描述 1. ...

  3. AVR单片机教程——串口接收

    本文隶属于AVR单片机教程系列.   上一讲中,我们实现了单片机开发板向电脑传输数据.在这一讲中,我们将通过电脑向单片机发送指令,让单片机根据指令控制LED.这一次,两端的TX与RX需要交叉连接,单片 ...

  4. Scrapy信号量

    1.类 from scrapy import signals class MySingle(object): def __init__(self): pass @classmethod def fro ...

  5. Flask DBUtils

    作用:创建连接池,解决多线程问题 1.安装模块 pip3 install -i https://pypi.douban.com/simple DBUtils 2.settings.py(配置文件) f ...

  6. javaWeb传收参数方式总结

    有时候,我真会被传参搞得头晕,这样传要怎么接收,那样传又要怎么接收? get可以json吗?什么是json方式提交?等等问题,已困扰我许久 所以,在此想做个总结,整理一下思绪,不再为传收参烦恼!如有错 ...

  7. 微服务的多数据源配置: step 1

    spring boot + mybatis: 实现的功能点: 多数据源 jdbc: spring.datasource.test1.url = jdbc:mysql://localhost:3306/ ...

  8. 每天翻译一点点: WPF Application Framework (WAF)

    ps:http://waf.codeplex.com/wikipage?title=Model-View-ViewModel%20Pattern&referringTitle=Document ...

  9. docker-Gitlab、GitLab Runner安装

    以下操作均在CentOs下操作 1.Gitlab install ① 启动gitlab docker run --detach \ --hostname 115.30.149.35 \ --publi ...

  10. Java常见问题汇总

    1.String,StringBuffer,StringBulider的区别及应用场景 2.Servlet生命周期 3.向上转型与向下转型 4.Java的多态性 5.重写和重载的区别 6.深拷贝和浅拷 ...