网卡测试软件 源码,网卡厂商自动识别工具(附源代码)

本文介绍了一款在渗透测试中使用的工具,它能自动解析ARP输出,根据MAC地址的前三个字节从OUI数据库中匹配网卡厂商信息,极大简化了获取主机品牌的工作。通过实例演示了操作命令、输入输出样例,并展示了如何从厂商识别到MAC地址的便捷过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原标题:网卡厂商自动识别工具(附源代码)

在渗透测试过程中,为了推测局域网内主机品牌,一个简单易行的办法就是通过ARP协议获取主机MAC地址列表,再通过互联网手动查询其所属厂商。笔者分享的工具实现了在ARP命令(arp -a)输出文件上自动添加相应厂商信息的功能。工具虽小,但是解决了实际需求。

1 基础知识

网卡物理地址(MAC地址)共有6个字节48位组成,前三个字节由网卡制造商从IEEE组织申请获得,后三个字节由网卡制造商自行编制。前三个字节又称为组织唯一标识符(OUI,Organizationally unique identifier),IEEE组织发布的oui.txt文件中记录着世界上所有网卡制造商与MAC地址前三个字节的对应关系。

3e2ebde2fd05c0dc9c6bf7e3713281a1.png

2 实现原理

网卡厂商自动识别工具实现流程如图2所示,主要包括两个过程:初始化过程和添加厂商过程。初始化过程完成了组织唯一标识符库(即MAC地址前三个字节与网卡厂商对应关系表)的加载和输入输出流的创建。添加厂商过程主要是逐行检测“arp -a”命令输出文件,针对接口信息行直接输出结果,针对标题行添加ORG列名后输出结果,针对MAC地址行至组织唯一标识符库中检索并添加厂商信息后输出结果。

10dbf0fd4c5d28b861fe67a34e9dc69f.png

3 使用指南

3.1 操作命令

5353569323c26bc6e47a10bfe28d7c42.png

3.2 输入示例 arp-all.txt

231d2627f6261fb3f76b69e0be5266cb.png

3.3 输出示例 arp-all-org.txt

a38070161097ba34d158de3927cfa981.png

*本文作者:gaearrow,转载请注明来自FreeBuf(FreeBuf.COM)返回搜狐,查看更多

责任编辑:

虚拟网卡驱动源代码(原版): /* * snull.c -- the Simple Network Utility * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates * * The source code in this file can be freely used, adapted, * and redistributed in source or binary form, so long as an * acknowledgment appears in derived source files. The citation * should list that the code comes from the book "Linux Device * Drivers" by Alessandro Rubini and Jonathan Corbet, published * by O'Reilly & Associates. No warranty is attached; * we cannot take responsibility for errors or fitness for use. * * $Id: snull.c,v 1.21 2004/11/05 02:36:03 rubini Exp $ */ #include #include #include #include #include #include /* printk() */ #include /* kmalloc() */ #include /* error codes */ #include /* size_t */ #include /* mark_bh */ #include #include /* struct device, and other headers */ #include /* eth_type_trans */ #include /* struct iphdr */ #include /* struct tcphdr */ #include #include "snull.h" #include #include MODULE_AUTHOR("Alessandro Rubini, Jonathan Corbet"); MODULE_LICENSE("Dual BSD/GPL"); /* * Transmitter lockup simulation, normally disabled. */ static int lockup = 0; module_param(lockup, int, 0); static int timeout = SNULL_TIMEOUT; module_param(timeout, int, 0); /* * Do we run in NAPI mode? */ static int use_napi = 0; module_param(use_napi, int, 0); /* * A structure representing an in-flight packet. */ struct snull_packet { struct snull_packet *next; struct net_device *dev; int datalen; u8 data[ETH_DATA_LEN]; }; int pool_size = 8; module_param(pool_size, int, 0); /* * This structure is private to each device. It is used to
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值