资源简介
WIFI探针内核源码,通过解析wifi底层通讯协议,取得路由器附近的手机(sta设备)mac,openwrt操作系统。内核与应用层通讯使用genetlink
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include nk.h>
#include nk.h>
#include “csx_netlink.h“
/* attributes (variables): the index in this enum is used as a reference for the type
* userspace application has to indicate the corresponding type
* the policy is used for security considerations
*/
unsigned char GLOBAL_IsScan;
unsigned char GLOBAL_AddrLocalNum;
unsigned char GLOBAL_AddrLocal[ADDR_LOCAL_NUMBER][MAC_ADDR_LEN];
enum {
DOC_EXMPL_A_UNSPEC
DOC_EXMPL_A_MSG
DOC_EXMPL_A_DAT
__DOC_EXMPL_A_MAX
};
#define DOC_EXMPL_A_MAX (__DOC_EXMPL_A_MAX - 1)
/* attribute policy: defines which attribute has which type (e.g int char * etc)
* possible values defined in net/netlink.h
*/
static struct nla_policy doc_exmpl_genl_policy[DOC_EXMPL_A_MAX + 1] = {
// [DOC_EXMPL_A_MSG] = { .type = NLA_NUL_STRING }
[DOC_EXMPL_A_DAT] = { .type = NLA_UNSPEC }
};
#define VERSION_NR 1
/* family definition */
static struct genl_family doc_exmpl_gnl_family = {
.id = GENL_ID_GENERATE //genetlink should generate an id
.hdrsize = 0
.name = “STAMAC“ //the name of this family used by userspace application
.version = VERSION_NR //version number
.maxattr = DOC_EXMPL_A_MAX
};
/* commands: enumeration of all commands (functions)
* used by userspace application to identify command to be ececuted
*/
enum {
DOC_EXMPL_C_UNSPEC
DOC_EXMPL_C_ECHO
__DOC_EXMPL_C_MAX
};
#define DOC_EXMPL_C_MAX (__DOC_EXMPL_C_MAX - 1)
/* an echo command receives a message prints it and sends another message back */
int doc_exmpl_echo(struct sk_buff *skb struct genl_info *info)
{
struct nlattr *na;
int rc;
void *msg_head;
char * mydata;
unsigned char snd_buff[1024];
if (info == NULL)
goto out;
struct nlmsghdr *nlhdr;
struct genlmsghdr *genlhdr;
struct nlattr *nlh;
char *str;
struct sk_buff *skb_p;
nlhdr = nlmsg_hdr(skb);
genlhdr = nlmsg_data(nlhdr);
nlh = genlmsg_data(genlhdr);
str = (char *)nla_data(nlh);
printk(“getstr= %c\n“*str);
if(*str == ‘s‘)
GLOBAL_IsScan = 1;
else
GLOBAL_IsScan = 0;
/* send a message back*/
skb_p = genlmsg_new(NLMSG_GOODSIZE GFP_KERNEL);
if (skb_p == NULL)
goto out;
msg_head = genlmsg_put(skb_p 0 info->snd_seq+1 &doc_exmpl_gnl_family 0 DOC_EXMPL_C_ECHO);
if (msg_head == NULL) {
rc = -ENOMEM;
goto out;
}
printk(“GLOBAL_AddrLocalNum= %u\n“GLOBAL_AddrLocalNum);
memcpy(snd_buff&GLOBAL_AddrLocalNumsizeof(GLOBAL_AddrLocalNum));
if(GLOBAL_AddrLocal > 0)
memcpy(snd_buff+sizeof(GLOBAL_AddrLocalNum)GLOBAL_AddrLocalGLOBAL_AddrLocalNum*MAC_ADDR_LEN);
rc = nla_put(skb_p DOC_EXMPL_A_DATsizeof(GLOBAL_AddrLocalNum)+GLOBAL_AddrLocalNum*MAC_ADDR_LENsnd_buff);
if (rc != 0)
goto out;
genlmsg_end(skb msg_head);
rc = genlmsg_unicast(genl_info_net(info) skb_p info->snd_porti
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-22 14:00 probe\
文件 4447 2017-09-03 19:02 probe\csx_netli
文件 606 2017-09-03 19:02 probe\csx_netli
文件 35548 2017-09-03 19:02 probe\main.c
文件 1176 2017-09-03 19:02 probe\Makefile
文件 105184 2017-09-03 19:02 probe\rx.c
相关资源
- SPI经典IP内核verilog
- compiler gcc5.h
- ESP8266 SDK 开发环境搭建 最简单 不限操
- 基于cef4delphi 的 cef3内核 多标签浏览器
- WifiFileTransfer1[1].0.1.3-黑莓8900 wifi传输
- Intel 5300网卡驱动iwlwifi-5000-ucode-8.83.
- linux rootkit源码
- wifi小车上位机代码
- stm32f103c8t6+ESP826 设置为AP模式
- Hi3861V 解决boot中导入第三方库的patc
- 常见wifi电路设计
- wireless net view_1.75版wifi监控破解
- Wifi自动连接工具
- 基站定位和WIFI定位完美结合项目源码
- 网狐6603内核引擎源码(免积分)
- 操作系统内核——毕业设计
- wifidog官方源码
- Athreos无线wifi芯片开发文档
- WIFI指纹采集工具app
- Fern-Wifi-Cracker_1.6_all
- 8051的内核的实现verilog
- wifi智能插座整个工程源文件
- 基于IE内核的多进程浏览器Raptor 源码
- 51单片机毕设wifi遥控小车源码
- WiFi介绍及技术原理
- qt界面连接wifi
- 无线AdHoc模式、虚拟Wifi组网配置实验
- ESP8266固件Wifi杀手 百度云链接
- wifi_通用密码.txt
- WIFI模块的电路图
评论
共有 条评论