📄 scanhost_head.h
字号:
#pragma pack(4)
#pragma comment(lib, "Ws2_32.lib")
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/timeb.h>
#include <time.h>
#include <iostream>
using namespace std;
/* the ip header */
typedef struct iphdr{
unsigned int headlen:4; //ip head length
unsigned int version:4; //ip version number
unsigned char tos; //servers type
unsigned short totallen; //ip packge total length
unsigned short id; //id number
unsigned short flag; // flags
unsigned char ttl; // life time
unsigned char prot; // protocol (tcp or udp)
unsigned short checksum; // check sum
unsigned int sourceIP; //source ip
unsigned int destIP; //dest ip
}IpHeader;
// ICMP header
typedef struct icmphdr{
BYTE type; //icmp type; the echo request type number is 8
BYTE code; // detail type
USHORT checksum; // check sum
USHORT id; // icmp packge id number
USHORT seq; // icmp data packge's serial number
}IcmpHeader;
//const data define
#define ICMP_ECHO 8
#define ICMP_ECHO_REPLY 0
#define ICMP_MIN 8
#define STATUS_FAILED 0xFFFF
#define DEF_PACKET_SIZE 32
#define MAX_PACKET 1024
#define MAX_PING_PACKET_SIZE ( MAX_PACKET + sizeof(IpHeader))
// define function
void fill_icmp_data( char *, int );
USHORT checksum( USHORT *, int );
void decode_resp( char*, int, struct sockaddr_in * );
DWORD WINAPI FindIP(LPVOID pIPAddrTemp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -