下载此文档

嗅探器.doc


文档分类:IT计算机 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
#include <> #include <> #include <> #include "" #ment(lib,"") #define MAX_PACK_LEN 65535 #define MAX_HOSTNAME_LAN 255 struct iphdr { unsigned char h_lenver; //4 位首部长度+4位 IP 版本号 unsigned char tos; //8 位服务类型 TOS unsigned short total_len; //16 位总长度(字节) unsigned short ident; //16 位标识 unsigned short frag_and_flags; //3 位标志位+13 位分段偏移 unsigned char ttl; //8 位生存时间 TTL unsigned char proto; //8 位协议(TCP, UDP 或其他) unsigned short checksum; //16 位 IP 首部校验和 unsigned int sourceIP; //32 位源 IP 地址 unsigned int destIP; //32 位目的 IP 地址}; struct tcphdr // 定义 TCP 首部{ unsigned short th_sport; //16 位源端口 unsigned short th_dport; //16 位目的端口 unsigned int th_seq; unsigned int th_ack; unsigned char th_lenres; //4 位首部长度/6 位保留字 unsigned int tcp_resl:4,tcp_hlen:4,tcp_fin:1,tcp_syn:1,tcp_rst:1,tcp_psh:1,tcp_ack:1, tcp_urg:1,tcp_res:2; unsigned short th_win; //16 位窗口大小 unsigned short th_sum; //16 位校验和 unsigned short th_urp; //16 位紧急数据偏移量}; struct udphdr // 定义 UDP 首部{ unsigned short uh_sport; //16 位源端口 unsigned short uh_dport; //16 位目的端口 unsigned short uh_len;//16 位长度 unsigned short uh_sum;//16 位校验和}; void main() { char RecvBuf[MAX_PACK_LEN] = {0}; struct iphdr *iphdr; struct tcphdr *tcphdr; struct udphdr *udphdr; SOCKET SockRaw; int bytes_recieved; WSADATA wsaData; WSAStartup(MAKEWORD(2,2),&wsaData); // 初始化 SOCKET SockRaw = socket( , SOCK_RAW , IPPROTO_IP); char FAR nam

嗅探器 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人yjjg0025
  • 文件大小109 KB
  • 时间2017-05-15
最近更新