简述python中列表的基本操作及使用的函数,python列表命令

  简述python中列表的基本操作及使用的函数,python列表命令

  关于提供的接口函数按其作用可分为四类:

  * 内存管理(分配和释放)函数

  * 地址解析函数

  * 数据包构造函数

  * 数据包发送函数

  以下分别列出这些接口函数及其功能(其参数含义简单易懂,不再解释):

  内存管理函数

  单数据包内存初始化:

  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);

  获取接口设备互联网协议(互联网协议)地址:

  u _ long libnet _ get _ IP addr(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);

  数据包构造函数

  空袭预防措施协议数据包:

  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);

  域名服务器(域名服务器)协议数据包:

  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_ECHO/ICMP_ECHOREPLY):

  int libnet _ build _ icmp _ echo(u _ char类型,u _ char代码,u_short id,

  u_short seq,const u_char *payload,int payload_len,u _ char * packet _ buf);

  网间控制报文协议(互联网控制消息协议)协议数据包(ICMP_MASKREQ/ICMP_MASKREPLY):

  int libnet _ build _ icmp _ mask(u _ char类型,u _ char代码,u_short id,

  u_short seq,u_long mask,const u_char *payload,int payload_len,

  u _ char * packet _ buf);

  网间控制报文协议(互联网控制消息协议)协议数据包(ICMP_UNREACH):

  int libnet _ build _ icmp _ un reach(u _ char类型,u _ char代码,

  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_TIMEXCEED):

  int libnet _ build _ icmp _ time exceed(u _ char类型,u _ char代码,

  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_REDIRECT):

  int libnet _ build _ icmp _ redirect(u _ char类型,u _ char代码,u_long网关,

  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_TSTAMP/ICMP_TSTAMPREPLY):

  int libnet _ build _ icmp _ timestamp(u _ char类型,u _ char代码,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);

  协议协议数据包:

  int libnet_build_igmp(u_char类型,u_char代码,u_long ip,

  const u_char *payload,int payload_len,u _ char * packet _ buf);

  互联网协议(互联网协议)协议数据包:

  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);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包:

  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);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(你好):

  int libnet _ build _ OSPF _ hello(u _ long网络掩码,u_short间隔,

  u字符选项,u_char优先级,u_int dead_interval,u_long des_router

  u_long backup,u_long neighbor,const char *payload,int payload_s,u _ char * buf);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(数据库描述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);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链接状态请求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);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链路状态更新(LSU)):

  int libnet _ build _ OSPF _ LSU(u _ int num,const char *payload,int payload_s,u _ char * buf);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链路状态确认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链路状态网络链路状态路由器):

  int libnet _ build _ OSPF _ LSA _ net(u _ long网络掩码,u_int路由器id,

  const char *payload,int payload_s,u _ char * buf);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链路状态路由器):

  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);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链接状态摘要):

  int libnet _ build _ OSPF _ LSA _总和(u _ long网络掩码,u_int度量,u_int tos,

  const char *payload,int payload_s,u _ char * buf);

  开放式最短路径优先(开放式最短路径优先内部网关协议)路由协议数据包(链接状态为外部):

  int libnet _ build _ OSPF _ LSA _ as(u _ long网络掩码,u_int度量,

  u_long fwd_addr,u_int tag,const char *payload,int payload_s,u _ char * buf);

  长裂口路由协议数据包:

  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);

  三氯苯酚协议数据包:

  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);

  用户数据报协议(用户数据报协议)协议数据包:

  int libnet _ build _ UDP(u _ short sport,u_short dport,const u_char *payload,int payload_len,u _ char * packet _ buf);

  互联网协议(互联网协议)协议数据包选项:

  int libnet _ insert _ IPO(struct I option * opt,u_char opt_len,u _ char * packet _ buf);

  三氯苯酚协议数据包选项:

  int libnet _ insert _ tcpo(struct tcpoption * opt,u_char opt_len,u _ char * packet _ buf);

  数据包发送函数

  打开原始套接字:

  int libnet_open_raw_sock(int协议);

  关闭原始套接字:

  int libnet _ close _ raw _ sock(int socket);

  选择接口设备:

  int libnet _ select _ device(struct sockaddr _ in * sin,

  u _ char * *设备,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);

  发送互联网协议(互联网协议)数据包:

  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模块);

  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);

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: