📄 synping.h
字号:
// SYNPing.h: interface for the CSYNPing class.
// SYNPing类:实现对目标主机指定端口的SYN探测和扫描
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SYNPING_H__78399B62_7983_497E_962C_F4B6FDB9A84F__INCLUDED_)
#define AFX_SYNPING_H__78399B62_7983_497E_962C_F4B6FDB9A84F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define SEQ 0x28376839
typedef struct _iphdr //定义IP首部
{
unsigned char h_verlen; //4位首部长度,4位IP版本号
unsigned char tos; //8位服务类型TOS
unsigned short total_len; //16位总长度(字节)
unsigned short ident; //16位标识
unsigned short frag_and_flags; //3位标志位
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地址
}IP_HEADER;
struct ABCD //定义TCP伪首部
{
unsigned long saddr; //源地址
unsigned long daddr; //目的地址
char mbz;
char ptcl; //协议类型
unsigned short tcpl; //TCP长度
};
extern ABCD psd_header;
typedef struct _tcphdr //定义TCP首部
{
USHORT th_sport; //16位源端口
USHORT th_dport; //16位目的端口
unsigned int th_seq; //32位序列号
unsigned int th_ack; //32位确认号
unsigned char th_lenres; //4位首部长度/6位保留字
unsigned char th_flag; //6位标志位
USHORT th_win; //16位窗口大小
USHORT th_sum; //16位校验和
USHORT th_urp; //16位紧急数据偏移量
}TCP_HEADER;
class CSYNPing
{
public:
CSYNPing();
virtual ~CSYNPing();
USHORT checksum(USHORT *buffer, int size);
//实现Ping操作
//0: 主机不存在
//1: 主机存在但没监听指定端口
//2: 主机存在并监听指定端口
int Ping(char *dest,int port);
};
#endif // !defined(AFX_SYNPING_H__78399B62_7983_497E_962C_F4B6FDB9A84F__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -