#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. Java Data类

    Date类的概述 java.util,Date 表示日期和时间的类类 Date 表示特定的瞬间,精确到千分之一秒(毫秒) 获取时间原点到当前系统时间经历了多少秒 // 时间原点:1970 年 01 月 ...

  2. js获取url地址栏参数的方法,解决中文乱码问题,能支持中文参数

    第一种:参数只能是英文的 function getQuery(name) { var reg = new RegExp("(^|&)" + name + "=([ ...

  3. python中类的输出或类的实例输出为何是<__main__类名 object at xxxx>这种形式?

    原因: __str__()这个特殊方法将对象转换为字符串的结果 效果图: 代码: # 定义一个Person类 class Person(object): """人类&qu ...

  4. 什么是aPaas?aPaas与低代码又是如何促进应用程序开发现代化的?

    从软件即服务(SaaS)到基础设施即服务(IaaS),云计算的兴起使“一切皆服务”(XaaS)模型得以泛滥,而aPaaS可能是这些模型中最鲜为人知的模型.随着aPaaS市场预计将从2018年的近90亿 ...

  5. 倍增LCA模板2董博文版 伪代码

    Dfs(int rt){ f[][rt]; ;k<=;k++) f[k][rt]=f[k-][f[k-][rt]]; } int LCA(int x,int y){ if(Dp[x]<Dp ...

  6. mysql安装忘记初始密码怎么办

    title: MySQL安装过程忘记初始密码最简单最简单解决办法 MySQL安装过程忘记初始密码最简单解决办法 ​ 在安装MySQL的时候会给定一个初始的密码,而这个初始的密码特别恶心人一堆大小写特殊 ...

  7. python 封装底层实现原理

    事实上,python封装特性的实现纯属"投机取巧",之所以类对象无法直接调用私有方法和属性,是因为底层实现时,python偷偷改变了它们的名称. python在底层实现时,将它们的 ...

  8. KMP——强大的next数组

    \(KMP\) 的原理不在这里仔细讲了,主要说说最近刷题总结出的 \(next\) 数组的强大功能. 部分例题来自<信息学奥赛一本通>的配套练习. 基于定义--字符串相同前后缀 " ...

  9. pikachu漏洞练习之sql注入

    这里因为实验的时候只记录了一部分所以就展示一部分 1.1.1数字型注入 (1)看到界面发现是查询id功能,没有在url里看到有传参所以应该是post方法提交数据. (2)进行sql注入之前我们最好是先 ...

  10. C语言实现按位拷贝

    在程序开发过程中,我们经常会用到按位拷贝一串二进制数,在此提供一个按位拷贝的函数给大家参考,函数源码如下: #define char_t char #define uint8_t unsigned c ...