调用winpcap发送路由器公告
- #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发送路由器公告的更多相关文章
- sqlserver能否调用webservice发送短信呢?
上班的时候突然有一个想法,sqlserver能否调用webservice发送短信呢? 经过查找资料,终于找到了解决办法,现将步骤贴到下面: (1)开启sqlserver组件功能,如果不开启这个组件功能 ...
- android 中调用接口发送短信
android中可以通过两种方式发送短信 第一:调用系统短信接口直接发送短信:主要代码如下: //直接调用短信接口发短信 SmsManager smsManager = SmsManager.getD ...
- 使用nodejs调用微信发送红包
前置条件:申请微信发送红包的账户及其权限 依赖 blueimg-md5和 xmlreader 库 /common/weixin.js 源码 /** * Created by chent696 on 2 ...
- C#调用Mail发送QQ邮件
需要用到: 1.System.Net.Mail; 2.QQ邮箱的POP3/SMTP服务码 QQ邮箱的POP3/SMTP服务码获取方法: 1.打开qq邮箱: 2.进入设置页面-->账户:(往下翻) ...
- php调用微信发送自定义模版接口
function sendWechatmodel($openid,$data,$go_url)//接受消息的用户openid,发送的消息,点击详情跳转的url { ...
- winpcap 发送接收速率
总体情况: 在不修改winpcap源码的情况下,发包.收包最大速率3包/ms. 收包几个api的速率: 1. m_fp = pcap_open_live(adapter->name, 65536 ...
- iOS调用系统发送短信和邮件分享
//发送邮件 -(void)sendMail:(NSString*)subject content:(NSString*)content{ MFMailComposeViewController*co ...
- Android调用Webservice发送文件
一服务器端C#这里有三个上传方法1.uploadFile( byte []bs, String fileName); PC机操作是没有问题2. uploadImage(String filename, ...
- 一次ajax调用,发送了两次请求(一次为请求方法为option,一次为正常请求)
在项目了开发时遇见一个奇怪的现象,就是我在js里面发送一次ajax请求,在浏览器network那边查询到的却是发送了两次请求,第一次的Request Method参数为OPTIONS,第二次的Requ ...
随机推荐
- 1、使用 as 而不要用 is
public class ShouldAsNotIs { public void ShouldAs() { object a = new ShouldAsNotIs(); var b = a as S ...
- dp-划分数 (递推)
问题描述 : 有 n 个无区别的物品 , 将他们分成 不超过 m 堆, 问有多少种分法 ? 例如 : n = 4 , m = 3 , 则总共有的分法是 1 + 2 +1 , 0 + 1 + 3 , 0 ...
- 理解Stream(一)——串行与终止操作
Java 8 stream特性是一个能快速降低开发人员工作量的语法糖,用起来很简单,用好了很难.这里就通过一系列的博客对几个常见的错误进行解释说明,并给出替代方法.这里先说明串行和终止操作. 首先,给 ...
- 深入理解Java虚拟机-类加载连接和初始化解析
不管学习什么,我一直追求的是知其然,还要知其所以然,对真理的追求可以体现在方方面面.人生短短数十载,匆匆一世似烟云,我认为,既然来了,就应该留下一些有意义的东西.本系列文章是结合张龙老师的<深入 ...
- git 其它补充(版本)
1.给源码贡献力量(当自己比较牛逼时) pull request 2..gitignore文件 在创建仓库的时候可以进行设置 3.版本 git tag -a v1.0 -m '版本介绍' 本地创建Ta ...
- python 安装虚拟环境virtualenv
1.sudo apt install virtualenv 安装失败 2.sudo apt-get update 更新失败 提示: E: 仓库 “http://mirrors.aliyun.com/u ...
- Idea破解至2089年
我是用的版本是2018.3.6,别的朋友使用的是2019的某个版本,不过关都不影响破解 下载jar包:链接:https://pan.***baidu.***com/s/1aRR0***2YNI9jew ...
- 对于kvm配置ssh
首先我们要让自己的机器开启ssh服务 首先更新源 sudo apt-get update 安装ssh服务 sudo apt-get install openssh-server 检测是否已启动 ps ...
- linux C++类中成员变量和函数的使用
1.undefined reference to XXX 问题原因 1)XXX所在的so库等未指定 2)XXX在类中实现的时候没有加上类::函数的格式 2. was not declared in t ...
- 爬虫之协程,selenium
1.什么是代理?代理和爬虫之间的关联是什么? 2.在requests的get和post方法常用的参数有哪些?分别有什么作用?(四个参数) - url headers parmas/data proxi ...