Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Download http://hidemyass.com/files/8jjbx/
- error_reporting('off');
- /*
- Ban HTTP flooders V2
- By AkaStep 4 brothers.
- */
- define("MYDIRFORINC",substr(str_ireplace('\\','/',htmlentities(str_ireplace('\\','/',__FILE__))),0,strrpos(htmlentities(__FILE__),DIRECTORY_SEPARATOR)+1));//el vurma
- define("ROOTDIR",htmlentities($_SERVER['DOCUMENT_ROOT']).str_ireplace('\\','/',DIRECTORY_SEPARATOR). '.htaccess');//el vurma
- define("DEBUGMSG","INCLUDE EDILIB");// bu debug ucundur pozma ve deyisdirme onu.
- define("CRONFILE",'crontask.txt');
- /*
- 1-saniyede maximum nece connect etse ban edek? default 7 connect
- Problem yaratsa ve gunahsiz userleri ban etse bu reqemi bir qeder artir.
- */
- $limit=7;//
- // HTACCESS BLOK IP //
- /* 1 yazsin htaccess-e.
- 0 yazmasin */
- $usehtaccess=1;// default yazir .htaccess-e
- // EOF HTACCESS BLOK IP //
- /* EL VURMA HECNEYE ASAGIDA amma
- $msg-i ureyin istediyin kimi deyisdire bilersen)
- */
- /* EOF */
- $msg='<html>
- <head>
- <style type="text/css">
- body, a, a:hover {cursor: url(../images/cur116.cur), progress;}
- body
- {
- background-color: black;
- background-image: url(../images/backaground.jpg);
- }
- </style>' .
- '<title>Banned For Flood!</title></head>
- <body>' .
- str_repeat('<ul>'. PHP_EOL,8) .
- '<br>
- <br>
- <font color="red" size="15">' .PHP_EOL .
- 'Ban Edilmisən!<br>
- Səbəb:Flood Edirsən!<br>
- No Flood!<br>
- CoDeD By /AkaStep.<br>
- <br>'.PHP_EOL .
- '</font>'. str_repeat('</ul>'. PHP_EOL,8) .
- '</body>
- </html>';
- /* request kimden gelir onun IP adresini aliriq */
- $ip=htmlspecialchars($_SERVER['REMOTE_ADDR']);
- /* IP-nin formatini da yoxlayaq
- Cunki ekser hostlarda spoof edildiyi tedqirde IP adres real ip evezine istenilen pox pusur gostere biler(spoof edilmisi)
- */
- if(!filter_var($ip,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))
- {
- $error=1;
- }
- if(isset($error))
- {
- unset($error);
- die($msg);
- }
- /* EOF IP CHECK */
- $usehtaccess=(int)$usehtaccess;
- /* Istesen deyisdir amma pozma bezi seyler bundan asilidir skriptde */
- $saltedhash='Ka?ydE#hdZeBOopzo~[BFy_S11?9G43FH
- <S3M+,\j[Reo#Av^+]1)>0k`=OVz5iZL=
- ,;&cAx/\3wMoj<Hks$wb(BU\KYqMCq_Am
- O^uh~pn(,{N7]8l[6^~j^\2Y54N8?2;M?
- |3(h>:}9C5-6#e(gxG?-W.vG{)VhGT:Ey
- xla;nIaG1$iO7P\ij5>>-c710YFbPI=QL
- n(kB#V4IC-JlO1zQcU=k9P}r;$g44d~s(
- Bc$4ru/EBT[p/sUl3yR4NLPl`2e3[ZHcF
- :aNgeGC+4FIUJTGXXH%kE-dlQnQpjp72]
- PI7DycRj#{YRz@okPP2%4rAb)#9r;yb4$
- jC@by(t5m[t&Kuv|)g/.6p\)zmnNHv5^u
- eN8+^mNYUi^DjnC1YJn:KIVPh(,;QbB6c
- B#{E6H=)KL:+MAt[fw4m~Y$--/7oa-7=Z
- ?%0kcc6`7L9i59pt@IW!]%W&}osx?|CaR
- >$k^_k?F>^M\{dJ7^Bros\)g7fnYb<by1
- @y`.2Hj/M?nz%r/exKD-`Ez65okP>McV!
- M1|UwI@yraH&yy7b<!;k5,8{*;nc1rW?F
- ';
- $logfile=MYDIRFORINC .substr(sha1(md5($ip) . sha1(md5($saltedhash))),0,20) . '_temp_' . md5(str_ireplace('.','_',$ip)) . '.txt';// muveqqeti faylmiz.Deyisdirme!
- //die($logfile);
- $banfile=MYDIRFORINC .'banned.txt';// ban edilmislerin siyahisi.
- if(file_exists($banfile) && is_readable($banfile))
- {
- $yoxlayiriqbanedilibyayox=file($banfile,FILE_IGNORE_NEW_LINES);
- /*
- Ban siyahisinda 50 den yuxari yazi varsa resurslari az yemesi ucun log faylin
- kopyasini yaradib kohnesini pozuruq.
- */
- if(count($yoxlayiriqbanedilibyayox) >50)
- {
- if(copy($banfile,MYDIRFORINC . 'bancopy_' .time() . '_.bak'))
- {
- @unlink($banfile);
- }
- }
- if(in_array($ip,$yoxlayiriqbanedilibyayox)) die($msg);
- }
- $time=time();
- $handle=fopen($logfile,'a+');
- fwrite($handle,$ip . '#' .$time . PHP_EOL);
- fclose($handle);
- $arr=file($logfile);
- $newtime=NULL;
- foreach($arr as $items)
- {
- $newip=substr($items,0,strpos($items,'#'));
- if($ip===$newip)
- {
- $newtime.=str_ireplace($newip . '#','',$items);
- if(substr_count($newtime,$time) >=$limit)
- {
- //echo $newtime . '<br>';
- // Ban siyahisina atiriq //
- $newbanhandle=fopen($banfile,'a+');
- fwrite($newbanhandle,$ip . PHP_EOL);
- fclose($newbanhandle);
- // Ban siyahisina atdiq //
- /* .htaccess faylina atiriq hemin IP-ni *deny from xxx.xxx.xxx.xxx* metodu ile*/
- if($usehtaccess===1)
- {
- $htblockhandle=fopen(ROOTDIR,'a+');
- /* internal server errorun qarsini almaq ucun 2 CRLF (PHP_EOL) buraxdim burda.
- Xususile bu aiddir boyuk nagruzka altinda olanda Server .htaccess-e yazi sehv duse biler ve ehtimal boyuk olur log sehv yazilsin movqe baximindan.
- Her ehtimal ucun 2CRLF buraxdim internal server errorun qarsisini almaq ucun.*/
- fwrite($htblockhandle,PHP_EOL.'deny from ' . $ip .PHP_EOL);
- fclose($htblockhandle);
- }
- /*EOF .htaccess -e atdiq IP adresi ve davam edirik */
- /* indi ise isimizi dayandiririq */
- unlink($logfile);
- die($msg);
- }
- }
- unset($items);
- }
- /* EOF */
- writemydate();
- function writemydate()
- {
- if(!file_exists(MYDIRFORINC . CRONFILE))
- {
- $startdate=date('j/n/Y');
- $cronhandle=fopen(MYDIRFORINC . CRONFILE,'w+');
- fwrite($cronhandle,$startdate);
- fclose($cronhandle);
- }
- }
- checkcleanup();
- function checkcleanup()
- {
- $enddate=date('j/n/Y');// hesablamaq ucun. Indiki ile kecmisi.
- $croncontent=file_get_contents(MYDIRFORINC . CRONFILE);
- //die($croncontent);
- /* Cron faylimiza mudaxile olunubsa ve formati korlanibsa yenisini yaradiriq*/
- if(!ctype_digit(str_ireplace('/','',$croncontent)))
- {
- //die(MYDIRFORINC .CRONFILE);
- unlink(MYDIRFORINC .CRONFILE);
- writemydate();
- }
- $startexplode=explode('/',$croncontent);
- $startyear=@$startexplode[2]; // il
- $startmonth=@$startexplode[1]; // ay
- $startday=@$startexplode[0]; // gun
- $strt = strtotime("{$startyear}/{$startmonth}/{$startday}");
- /* */
- $enddateexplode=explode('/',$enddate);
- $enddate = strtotime("{$enddateexplode[2]}/{$enddateexplode[1]}/{$enddateexplode[0]}");
- /* */
- //die((round(abs($strt-$enddate)/60/60/24) + 1));
- /* BU CRON 1 GUNDEN 1 TEKRARLANACAQ */
- //die(MYDIRFORINC);
- if((round(abs($strt-$enddate)/60/60/24) + 1) >1)// 1 gunden bir temizleyeceyik
- {
- //baslayiriq temizlemeye zir zibilden bu direktoriyani
- $tempfiles=@scandir(MYDIRFORINC);
- if(is_array($tempfiles) && count($tempfiles)!==0)
- {
- $initialize=NULL;
- foreach($tempfiles as $pozbunlari)
- {
- $pozbunlari=basename($pozbunlari);
- if($pozbunlari==='.' || $pozbunlari==='..' || is_dir(MYDIRFORINC .$pozbunlari)) continue;
- if(is_file(MYDIRFORINC .$pozbunlari) && stristr(MYDIRFORINC .$pozbunlari,'_temp_') && strlen($pozbunlari) >60)
- {
- $initialize++;
- @unlink(MYDIRFORINC.$pozbunlari);
- }
- }
- unset($pozbunlari);
- if(isset($initialize) && $initialize>=1) @unlink(MYDIRFORINC . CRONFILE);unset($initialize);
- }
- }
- }
- /* EOF */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement