r11
r6
1[[분류:Aidenk]]
2[목차]
r1
3== 개요 ==
4특정 서버나 네트워크에 과도한 트래픽을 발생시켜 정상적인 서비스 제공을 방해하는 사이버 공격.
5
r2
6매우 간단한 예제이다.
r3
7원리는 requests로 서버에 과부화를 주는 것. --사실상 이코드로 DDos 공격은 불가능이다.--
r1
8
r8
9신기하게 깃허브에는 DDOS 코드가 존재한다...
10
r1
11{{{#!syntax python
12import requests
13
r4
14url = "https://www.google.com"
r1
15
16for i in range(1):
r9
17 a = requests.post(url)
r5
18
19print(a)
20print(a.text)
r6
21}}}
22
r10
23{{{#!syntax csharp
24using System;
25using System.Net.Http;
26using System.Threading.Tasks;
27
28class Program
29{
30 static async Task Main(string[] args)
31 {
32 string url = "https://www.google.com";
33
34 using (HttpClient client = new HttpClient())
35 {
36 HttpResponseMessage response = await client.PostAsync(url, null);
37
38 Console.WriteLine(response);
39 string text = await response.Content.ReadAsStringAsync();
40 Console.WriteLine(text);
41 }
42 }
43} }}}
44{{{#!syntax cpp
r11
45#include <iostream>
46#include <string>
47#include <curl/curl.h>
r10
48
r11
49size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* buffer) {
50 size_t totalSize = size * nmemb;
51 buffer->append((char*)contents, totalSize);
52 return totalSize;
53}
54
55int main() {
56 CURL* curl;
57 CURLcode res;
58 std::string response;
59
60 curl = curl_easy_init();
61
62 if (curl) {
63 curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com");
64
65
66 curl_easy_setopt(curl, CURLOPT_POST, 1L);
67
68
69 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
70 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
71
72
73 res = curl_easy_perform(curl);
74
75
76 std::cout << "Response Code: " << res << std::endl;
77 std::cout << "Response Text:\n" << response << std::endl;
78
79 curl_easy_cleanup(curl);
80 }
81
82 return 0;
83}
r10
84}}}
85
r6
86== 범죄 ==
87사이버 공격은 엄연한 범죄이다.