- 浏览: 472207 次
- 性别:
- 来自: 长沙
文章分类
最新评论
-
Source_野驴:
...
jsp静态化和伪静态化 -
zidanzzg:
很好的知识,找到了利用异或交换数值的理论支持,谢谢分享
XOR的性质和运算 -
ueseu:
引用(2) DomainDomain域名也是Cookie的一部 ...
Cookie的组成 -
ueseu:
引用Secure取true或者false值。如果为true,那 ...
Cookie的组成 -
liqi___123:
理解得很透彻,谢谢!!
ROLAP、MOLAP和HOLAP联机分析处理区别
在Unix系统平台上的网络安全工具开发中,目前最为流行的C API library有libnet、libpcap、libnids和 libicmp等。它们分别从不同层次和角度提供了不同的功能函数。使网络开发人员能够忽略网络底层细节的实现,从而专注于程序本身具体功能的设计与开 发。其中,
* libnet提供的接口函数主要实现和封装了数据包的构造和发送过程。
* libpcap提供的接口函数主要实现和封装了与数据包截获有关的过程。
* libnids提供的接口函数主要实现了开发网络入侵监测系统所必须的一些结构框架。
* libicmp等相对较为简单,它封装的是ICMP数据包的主要处理过程(构造、发送、接收等)。
利用这些C函数库的接口,网络安全工具开发人员可以很方便地编写出具有结构化强、健壮性好、可移植性高等特点的程序,如scanner、sniffer、firewall、IDS等。
---[ libnet ]------------------------------------------
libnet 库的最新版本为1.0.0,它一共约7600行C源代码,33个源程序文件,12个C头文件,50余个自定义函数,提供的接口函数包含15种数据包生成器 和两种数据包发送器(IP层和数据链路层)。目前只支持IPv4,不支持IPv6。已经过测试的系统平台包括:
* OpenBSD 2.6snap, 2.5, 2.4, 2.3, 2.2 (i386)
* FreeBSD 4.0-STABLE, 3.3-STABLE, 3.2-RELEASE, 3.1-CURRENT, 3.0, 2.2 (i386)
* NetBSD 1.3.2 (i386)
* BSD/OS 3.x (i386)
* BSDi 3.0 (i386)
* Linux 2.2.x, 2.0.3x, 2.1.124 (i386, alpha) (libc: 2.4.x, glibc: 2.0.x)
* Solaris 7 (SPARC, gcc 2.7.2[13], 2.8.2), 2.6 (SPARC, gcc 2.8.2),
2.5.x (SPARC, gcc 2.7.2[13])
* IRIX 6.2
* MacOS 5.3rhapsody (powerpc)
libnet提供的接口函数按其作用可分为四类:
* 内存管理(分配和释放)函数
* 地址解析函数
* 数据包构造函数
* 数据包发送函数
以下分别列出这些接口函数及其功能(其参数含义简单易懂,不再解释):
★ 内存管理函数
单数据包内存初始化:
int libnet_init_packet(u_short packet_size, u_char **buf);
单数据包内存释放:
void libnet_destroy_packet(u_char **buf);
多数据包内存初始化:
int libnet_init_packet_arena(struct libnet_arena **arena,u_short packet_num, u_short packet_size);
访问多数据包内存中的下一个数据包:
u_char *libnet_next_packet_from_arena(struct libnet_arena **arena,u_short packet_size);
多数据包内存释放:
void libnet_destroy_packet_arena(struct libnet_arena **arena);
★ 地址解析函数
解析主机名:
u_char *libnet_host_lookup(u_long ip, u_short use_name);
解析主机名(可重入函数):
void libnet_host_lookup_r(u_long ip, u_short use_name, u_char *buf);
域名解析:
u_long libnet_name_resolve(u_char *ip, u_short use_name);
获取接口设备IP地址:
u_long libnet_get_ipaddr(struct libnet_link_int *l,const u_char *device, const u_char *ebuf);
获取接口设备硬件地址:
struct ether_addr *libnet_get_hwaddr(struct libnet_link_int *l,const u_char *device,const u_char *ebuf);
★ 数据包构造函数
ARP协议数据包:
int libnet_build_arp(u_short hrdw, u_short prot, u_short h_len,u_short p_len, u_short op, u_char *s_ha,
u_char *s_pa, u_char *t_ha, u_char *t_pa,const u_char *payload, int payload_len,u_char *packet_buf);
DNS协议数据包:
int libnet_build_dns(u_short id, u_short flags, u_short num_q,u_short num_answ_rr, u_short num_auth_rr,
u_short num_add_rr, const u_char * payload,int payload_len, u_char *packet_buf);
以太网协议数据包:
int libnet_build_ethernet(u_char *daddr, u_char *saddr, u_short id,const u_char *payload, int payload_len,
u_char *packet_buf);
ICMP协议数据包(ICMP_ECHO / ICMP_ECHOREPLY):
int libnet_build_icmp_echo(u_char type, u_char code, u_short id,
u_short seq, const u_char *payload,int payload_len, u_char *packet_buf);
ICMP协议数据包(ICMP_MASKREQ / ICMP_MASKREPLY):
int libnet_build_icmp_mask(u_char type, u_char code, u_short id,
u_short seq, u_long mask,const u_char *payload, int payload_len,
u_char *packet_buf);
ICMP协议数据包(ICMP_UNREACH):
int libnet_build_icmp_unreach(u_char type, u_char code,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);
ICMP协议数据包(ICMP_TIMEXCEED):
int libnet_build_icmp_timeexceed(u_char type, u_char code,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);
ICMP协议数据包(ICMP_REDIRECT):
int libnet_build_icmp_redirect(u_char type, u_char code, u_long gateway,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);
ICMP协议数据包(ICMP_TSTAMP / ICMP_TSTAMPREPLY):
int libnet_build_icmp_timestamp(u_char type, u_char code, u_short id,
u_short seq, n_time otime, n_time rtime,n_time ttime, const u_char *payload,
int payload_len, u_char *packet_buf);
IGMP协议数据包:
int libnet_build_igmp(u_char type, u_char code, u_long ip,
const u_char *payload, int payload_len,u_char *packet_buf);
IP协议数据包:
int libnet_build_ip(u_short len, u_char tos, u_short ip_id, u_short frag,u_char ttl, u_char protocol, u_long saddr, u_long daddr, const u_char *payload, int payload_len,u_char *packet_buf);
OSPF路由协议数据包:
int libnet_build_ospf(u_short len, u_char type, u_long router_id,u_long area_id, u_short auth_type,
const char *payload, int payload_s, u_char *buf);
OSPF路由协议数据包(Hello):
int libnet_build_ospf_hello(u_long netmask, u_short interval,
u_char options, u_char priority,u_int dead_interval, u_long des_router,
u_long backup, u_long neighbor,const char *payload, int payload_s,u_char *buf);
OSPF路由协议数据包(DataBase Description (DBD)):
int libnet_build_ospf_dbd(u_short len, u_char options, u_char type,
u_int sequence_num, const char *payload,int payload_s, u_char *buf);
OSPF路由协议数据包(Link State Request (LSR)):
int libnet_build_ospf_lsr(u_int type, u_int ls_id, u_long adv_router,
const char *payload, int payload_s,u_char *buf);
OSPF路由协议数据包(Link State Update (LSU)):
int libnet_build_ospf_lsu(u_int num, const char *payload,int payload_s, u_char *buf);
OSPF路由协议数据包(Link State Acknowledgement (LSA)):
int libnet_build_ospf_lsa(u_short age, u_char options, u_char type,u_int ls_id, u_long adv_router, u_int sequence_num, u_short len,const char *payload, int payload_s,u_char *buf);
OSPF路由协议数据包(OSPF Link Sate NetworkLink State Router):
int libnet_build_ospf_lsa_net(u_long netmask, u_int router_id,
const char *payload, int payload_s,u_char *buf);
OSPF路由协议数据包(Link State Router):
int libnet_build_ospf_lsa_rtr(u_short flags, u_short num, u_int id,
u_int data, u_char type, u_char tos,u_short metric, const char *payload,int payload_s, u_char *buf);
OSPF路由协议数据包(Link State Summary):
int libnet_build_ospf_lsa_sum(u_long netmask, u_int metric, u_int tos,
const char *payload, int payload_s,u_char *buf);
OSPF路由协议数据包(Link State AS External):
int libnet_build_ospf_lsa_as(u_long netmask, u_int metric,
u_long fwd_addr, u_int tag,const char *payload, int payload_s,u_char *buf);
RIP路由协议数据包:
int libnet_build_rip(u_char cmd, u_char ver, u_short domain,
u_short addr_fam, u_short route_tag, u_long ip,u_long mask, u_long next_hop, u_long metric,
const u_char *payload, int payload_len,u_char *packet_buf);
TCP协议数据包:
int libnet_build_tcp(u_short th_sport, u_short th_dport, u_long th_seq,
u_long th_ack, u_char th_flags, u_short th_win,u_short th_urg, const u_char *payload,int payload_len, u_char *packet_buf);
UDP协议数据包:
int libnet_build_udp(u_short sport, u_short dport, const u_char *payload,int payload_len, u_char *packet_buf);
IP协议数据包选项:
int libnet_insert_ipo(struct ipoption *opt, u_char opt_len,u_char *packet_buf);
TCP协议数据包选项:
int libnet_insert_tcpo(struct tcpoption *opt, u_char opt_len,u_char *packet_buf);
★ 数据包发送函数
打开raw socket:
int libnet_open_raw_sock(int protocol);
关闭raw socket:
int libnet_close_raw_sock(int socket);
选择接口设备:
int libnet_select_device(struct sockaddr_in *sin,
u_char **device, u_char *ebuf);
打开链路层接口设备:
struct libnet_link_int *libnet_open_link_interface(char *device,char *ebuf);
关闭链路层接口设备:
int libnet_close_link_interface(struct libnet_link_int *l);
发送IP数据包:
int libnet_write_ip(int socket, u_char *packet, int packet_size);
发送链路层数据包:
int libnet_write_link_layer(struct libnet_link_int *l,const u_char *device, u_char *packet,int packet_size);
检验和计算:
int libnet_do_checksum(u_char *packet, int protocol, int packet_size);
★ 相关的支持函数
随机数种子生成器:
int libnet_seed_prand();
获取随机数:
u_long libnet_get_prand(int modulus);
16进制数据输出:
void libnet_hex_dump(u_char * buf, int len, int swap, FILE *stream);
端口列表链初始化:
int libnet_plist_chain_new(struct libnet_plist_chain **plist,char *token_list);
获取端口列表链的下一项(端口范围):
int libnet_plist_chain_next_pair(struct libnet_plist_chain *plist,u_short *bport, u_short *eport);
端口列表链输出显示:
int libnet_plist_chain_dump(struct libnet_plist_chain *plist);
获取端口列表链:
u_char *libnet_plist_chain_dump_string(struct libnet_plist_chain *plist);
端口列表链内存释放:
void libnet_plist_chain_free(struct libnet_plist_chain *plist);
发表评论
-
ARP请求过程详解
2013-06-29 09:09 1297ARP请求详解1: ARP请求详解2: ... -
无线路由器WDS设置
2013-05-20 05:53 1088在WDS设置里面有三种不同的模式,下面分别对 ... -
HomePlug AV协议简介
2013-04-26 20:41 1571HOMEPLUG AV 编辑本段简 介 ... -
crontab命令详细解析
2013-04-24 10:15 1来源:http://blog.chinaunix.n ... -
sed命令详解
2013-04-20 16:11 11.简介 sed是非交互式的编辑器。它不会修改文件,除非使 ... -
Tomato DualWAN功能
2013-04-16 11:04 0Tomato DualWAN 使那些能刷Tomato或DD- ... -
SSH端口转发
2012-08-29 14:15 2278一、概述你在咖啡馆享 ... -
Linux记录用户操作记录
2012-05-21 14:42 2738如下方法在centos5.x系统中通过.在/etc/pro ... -
Linux文件与目录的三种时间状态
2012-05-21 10:18 39291. mtime(medify time):最后一 ... -
linux find命令-exec参数的使用说明
2012-05-21 10:03 1490前言:最近几天使用find的高级功能,但执行到 -exec ... -
CMDSHELL常用命令
2013-04-16 11:00 0cmdshell后门在黑客界广 ... -
宽带下载速率对照表
2012-03-11 18:07 0宽带下载速率对照表 宽带业务 下行速 ... -
关于无线路由能发射多少米
2013-04-16 10:58 1300每位买家都比较关心这个问题,不知道这个无线产品的有效 ... -
VPN穿透CMCC及ChinaNET
2012-03-08 23:20 0来源:http://fyscu.com/forum.php?m ... -
从实例学习DD-WRT之封杀P2P
2012-03-08 22:54 1357笔者曾经在DD-WRT特色 ... -
Bridge、WDS桥接和WISP万能中继的区别
2012-03-06 14:03 3793Bridge、WDS桥接和WISP万 ... -
超远距离无线联网测试(3公里)
2012-03-03 14:27 4364[软件网络][2007-31期]挑战3公里极限——超远距离无线 ... -
date命令的用法
2011-04-28 17:07 896在linux shell编程中,经常用到日期的加减运算 以前 ... -
理解Windows中的路由表和默认网关
2011-04-01 16:18 1468每一个Windows系统中都具有IP路由表,它存储了 ... -
HTTP头部解释
2010-12-28 12:15 1516在看http头部时候,想起了好久之前收藏的http头部的详细解 ...
相关推荐
libnet 构造数据包 开发库 很好恨强大的 一个程序开发库 使用C语言编写 但是源代码中使用了很多goto语句 不过思路还是很清晰地 如果要构造数据包 可是使用这个开发库 也可以自己看懂了这个开发库 自己写一个函数...
libnet是一个小型的接口函数库,主要用C语言写成,提供了低层网络数据包的构造...libnet的开发目的是:建立一个简单统一的网络编程接口以屏蔽不同操作系统底层网络编程的差别,使得程序员将精力集中在解决关键问题上。
数据包 开发包 libnet 网络 安全 数据包构造和发送开发包libnet
libnet
libnet的开发目的是:建立一个简单统一的网络编程接口以屏蔽不同操作系统底层网络编程的差别,使得程序员将精力集中在解决关键问题上。 2010-11-09 更新的1.1.5版本,是截至上传日的最新版本,请问轻信高版本号的...
libnet是一个小型的接口函数库,主要用C语言写成,提供了低层网络数据包的构造...libnet的开发目的是:建立一个简单统一的网络编程接口以屏蔽不同操作系统底层网络编程的差别,使得程序员将精力集中在解决关键问题上。
网络安全程序开发函数库:以计算机网络安全开发包技术为核心,详细讨论了几个著名的网络安全开发包,它们分别是网络数据包捕获开发包Libpcap,Windows网络数据包捕获开发包WinPcap,数据包构造和发送开发包Libnet,...
利用libnet库进行网络编程,方便快捷,易掌握!
vs2010编译生成libnet.dll libnet.lib 对应的libnet版本为1.2.3 对应库文件生成目录: libnet-libnet-1.2-rc3\libnet\src
libnet1.1.2编译完成后的libnet.dll与libnet.lib
自己手动编译的libnet.dll libnet.lib 对应的libnet版本为1.1.4
基于libnet介绍了网络数据包构造的基本步骤和具体实现方式
libnet编译后的libnet.dll跟libnet.lib。实在太难找了,欢迎大家下载,分数高一点,算是大家给一点资助
在Unix系统平台上的网络安全工具开发中,目前最为流行的...使网络开发人员能够忽略网络底层细节的实现,从而专注于程序本身具体功能的设计与开发。其中,libnet提供的接口函数主要实现和封装了数据包的构造和发送过程。
它提供了用于底层网络数据包写入和处理的可移植框架(将libnet与libpcap结合使用,您可以编写一些非常酷的东西)。 Libnet包括IP层和链路层的数据包创建,以及许多补充和补充功能。 Libnet非常便于编写网络工具和...
ibnet是一个小型的接口函数库,主要用C语言写成,提供了低层网络数据包的构造、...libnet的开发目的是:建立一个简单统一的网络编程接口以屏蔽不同操作系统底层网络编程的差别,使得程序员将精力集中在解决关键问题上。
网络安全开发包是指用于网络安全研究和开发的一些专业开发函数库,它的主要作用是实现网络安全研究和开发的基本功能,为研究者和开发者进一步研究和开发网络安全提供编程接口,使网络开发人员能够忽略网络底层细节的...
libnet 是一个小型的接口函数库,主要用 C 语言写成,提供了低层网络数据包的构造、处理和发送功能。
功能强大的数据包构造,数据包的处理,数据包发送,函数库。 例如我们要构造一个ip数据包,可以使用如下函数: libnet_ptag_t libnet_build_ipv4(u_short len, u_char tos, u_short id, u_short frag, u_char ttl, ...
本书以计算机网络安全开发包技术为核心,详细讨论了几个著名的网络安全开发包,它们分别是网络数据包捕获开发包Libpcap,Windows网络数据包捕获开发包WinPcap,数据包构造和发送开发包Libnet,通用网络安全开发包...