|
- Readme First! - Read and follow the rules, otherwise your posts will be closed |
|
|
|
|
|
There are currently, 301 guest(s) and 0 member(s) that are online.
You are Anonymous user. You can register for free by clicking here |
|
|
|
|
|
How to BAN IPS real fast!!! |
|
scandicdiscopub writes "Since they tried to hack me this morning and are trying ...
i made a banscript real fast ,if u need it just copy and paste the code below in your header.php
and make a txt file called banned.txt with an ip on each line.
so like
127.0.0.1
127.0.0.2
ok.
open header.php and all above just under the
paste this code:
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif (isset($_SERVER['HTTP_VIA'])) {
$ip = $_SERVER['HTTP_VIA'];
}
elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
else {
$ip = "Banned";
}
$banned = file("banned.txt", "r+");
$nbanned = count($banned);
function ban($ip, $banned, $nbanned){
for ($i = 0 ; $i You Have been banned from this portal, if you feel this is in error
please send email to you@yoursite.com ";
die();
}
}
}
ban($ip, $banned, $nbanned);
i m using it myself too at the moment!hehe
"
|
|
Posted on Saturday, December 13 @ 14:29:19 CET by Zhen-Xjell |
|
|
|
|
| |
|
Average Score: 5 Votes: 2

|
|
|
|
|
|
|
| | The comments are owned by the poster. We aren't responsible for their content. |
| | | | |
| No Comments Allowed for Anonymous, please register | | | | |
Re: How to BAN IPS real fast!!! (Score: 1) by XEULAS (MotherPlucker@KentuckyFriedChicken.com) on Saturday, December 13 @ 18:00:36 CET (User Info | Send a Message) http://www.SiteLance.com | I love the simplicity! Can you think of an easy way to automatically import the nukecops banlist each night?
Or even something like
$banned = file("http://nukecops.com/banned.txt", "r+");
|
Re: How to BAN IPS real fast!!! (Score: 1) by Daniel-cmw on Saturday, December 13 @ 18:48:03 CET (User Info | Send a Message) | Should work well but its http://computercops.biz/ipbans.txt
It would be good to use two banlists, one from nukecops and one you can keep yourself if you find yourself getting unwanted visitors. |
]
Re: How to BAN IPS real fast!!! (Score: 1) by XEULAS (MotherPlucker@KentuckyFriedChicken.com) on Saturday, December 13 @ 19:13:43 CET (User Info | Send a Message) http://www.SiteLance.com | WOw... This could be a great 'ease-of-use' development. The dual list suggestion is good.
I wonder, the ipbans.txt file isn't a straight list of IP's, it has additional info.... (and Im still studying php so my knowledge is limited), makes me wonder if the additional info might cause problems? (sample line below)
1055359058 - 06/11/2003 14:17:38 Host: 209.31.31.168.ptr.us.xo.net/209.31.31.168 Port: 445 TCP Blocked |
]
Re: How to BAN IPS real fast!!! (Score: 1) by scandicdiscopub on Saturday, December 13 @ 19:19:30 CET (User Info | Send a Message) | | or make it that the additional info is read as comment |
]
| | | | |
Re: How to BAN IPS real fast!!! (Score: 1) by B-truE on Saturday, December 13 @ 20:04:36 CET (User Info | Send a Message) | Isn't it easier to disallow them in the .htaccess file?
Just wondering...
Thanks.
|
Re: How to BAN IPS real fast!!! (Score: 1) by XEULAS (MotherPlucker@KentuckyFriedChicken.com) on Saturday, December 13 @ 20:37:52 CET (User Info | Send a Message) http://www.SiteLance.com | It very well may be, but I find that lots of people dont even know what an .htaccess files is, and many who do dont know how to format it. Id really like to see someone build a module or block that automatically takes the daily nukecops ipbans.txt and 'installs' it into an individual site.
|
]
| | | | |
Re: How to BAN IPS real fast!!! (Score: 1) by scandicdiscopub on Saturday, December 13 @ 20:40:17 CET (User Info | Send a Message) | it works 100% guaranteed!
just under the phpopeningtag put the code and name the txtt file as says in the code.
and upload it to your root thats it and one ip a line |
]
Re: How to BAN IPS real fast!!! (Score: 1) by hue on Saturday, December 13 @ 20:52:17 CET (User Info | Send a Message) | yes, it works fine for me :p thanks all
|
]
Re: How to BAN IPS real fast!!! (Score: 1) by tour93 on Saturday, December 13 @ 22:29:40 CET (User Info | Send a Message) http://suncafe.us | I get an parse error too from this line: for ($i = 0 ; $i You Have been banned from this portal, if you feel this is in error
please send email to you@yoursite.com ";
It seems something is missing: a ) and a ".
No? |
]
Re: How to BAN IPS real fast!!! (Score: 1) by scandicdiscopub on Saturday, December 13 @ 22:58:44 CET (User Info | Send a Message) | | lol the echo is missing i think they dont show here |
]
Re: How to BAN IPS real fast!!! (Score: 1) by morgue on Sunday, December 14 @ 05:45:13 CET (User Info | Send a Message) | It seems some lines are missing. I added below lines on the top of header.php and it works:
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif (isset($_SERVER['HTTP_VIA']))
{
$ip = $_SERVER['HTTP_VIA'];
}
elseif (isset($_SERVER['REMOTE_ADDR']))
{
$ip = $_SERVER['REMOTE_ADDR'];
}
else
{
die("You are banned.");
}
$banned = file("banned.txt", "r+");
function ban($ip, $banned) {
foreach ($banned as $val)
{
if ($val == $ip)
{
die ("You are banned.");
}
}
}
ban($ip, $banned);
And banned.txt is like
111.11.11.11
222.22.22.22
333.33.33.33
... |
]
| | | | |
Re: How to BAN IPS real fast!!! (Score: 1) by CodyG on Saturday, December 13 @ 21:03:12 CET (User Info | Send a Message) | | There are over 22,700 lines in the computercops ban list. If that file is called in myheader.php ... just how much longer will it take users to download any page on my nuke website? |
Re: How to BAN IPS real fast!!! (Score: 1) by scandicdiscopub on Saturday, December 13 @ 21:10:53 CET (User Info | Send a Message) | hehe im already working on the block lets see yes!
i should have it done like in a minute.
ill put it here too |
]
Re: How to BAN IPS real fast!!! (Score: 2, Interesting) by scandicdiscopub on Saturday, December 13 @ 21:29:33 CET (User Info | Send a Message) | if (eregi("block-Quickban.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
$content = "if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {";
$content .= " $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];";
$content .= " }";
$content .= " elseif (isset($_SERVER['HTTP_VIA'])) {";
$content .= " $ip = $_SERVER['HTTP_VIA'];";
$content .= " }";
$content .= " elseif (isset($_SERVER['REMOTE_ADDR'])) {";
$content .= " $ip = $_SERVER['REMOTE_ADDR'];";
$content .= " }";
$content .= " else {";
$content .= " $ip = "Banned";";
$content .= " }";
$content .= "";
$content .= "$banned = file("http://nukecops.com/banned.txt", "r+");";
$content .= "$nbanned = count($banned);";
$content .= "function ban($ip, $banned, $nbanned){";
$content .= "for ($i = 0 ; $i You Have been banned because either you did something wrong, or you are a shit-eater Either way, suck it up pal! ";";
$content .= "die();";
$content .= "}";
$content .= "}";
$content .= "}";
$content .= "ban($ip, $banned, $nbanned);";
its giving a parse error any help? |
]
Re: How to BAN IPS real fast!!! (Score: 1) by Audioslaved on Sunday, December 14 @ 01:50:33 CET (User Info | Send a Message) http://www.audioslaved.com | Why do you have everything in $conent .=" tags, the only thing you NEED to put in the $content tags are what would be your echo or print statements. plus your for statement is incomplete and you do not have the Your have been banned stuff in a content tag to echo it, it looks like you may have not copied your file in the comment correctly.
|
]
| | | | |
Re: How to BAN IPS real fast!!! (Score: 1) by tour93 on Saturday, December 13 @ 22:49:10 CET (User Info | Send a Message) http://suncafe.us | Hi,
Weblord.it has a banip module to download.
Just so you know. |
Re: How to BAN IPS real fast!!! (Score: 1) by Kaasie on Monday, December 15 @ 10:45:02 CET (User Info | Send a Message) http://www.kaasie.org | heres a simple text to ban people hard from whole site
make a file and save it as .htaccess in your webrootdirectory
enter the following and add the ip to ban as you like
----------
order deny,allow
# name of the (server attacker)
deny from xxx.xxx.xxx.xxx
----------
works like a charm to me |
]
Re: How to BAN IPS real fast!!! (Score: 1) by Kaasie on Monday, December 15 @ 10:48:08 CET (User Info | Send a Message) http://www.kaasie.org | phpnuke isnt allowing code limit to post so heres a new one with spaces
order deny,allow
# name of the (server attacker)
deny from xxx.xxx.xxx.xxx
|
]
Re: How to BAN IPS real fast!!! (Score: 1) by XEULAS (MotherPlucker@KentuckyFriedChicken.com) on Monday, December 15 @ 12:55:10 CET (User Info | Send a Message) http://www.SiteLance.com | Hi.
I question the order of deny, allow. I went and looked at the Apache mod_access docs (http://httpd.apache.org/docs/mod/mod_access.html), and it appears the deny, allow would allow everyone access (because the deny is evaluated first, THEN the allow (which is all). So the order should be allow,deny. What do you think (im no expert)?
Here is the part of the docs
Order directive
Syntax: Order ordering
Default: Order Deny,Allow
Context: directory, .htaccess
Override: Limit
Status: Base
Module: mod_access
The Order directive controls the default access state and the order in which Allow and Deny directives are evaluated. Ordering is one of
Deny,Allow
The Deny directives are evaluated before the Allow directives. Access is allowed by default. Any client which does not match a Deny directive or does match an Allow directive will be allowed access to the server.
Allow,Deny
The Allow directives are evaluated before the Deny directives. Access is denied by default. Any client which does not match an Allow directive or does match a Deny directive will be denied access to the server.
Mutual-failure
Only those hosts which appear on the Allow list and do not appear on the Deny list are granted access. This ordering has the same effect as Order Allow,Deny and is deprecated in favor of that configuration.
Keywords may only be separated by a comma; no whitespace is allowed between them. Note that in all cases every Allow and Deny statement is evaluated.
In the following example, all hosts in the apache.org domain are allowed access; all other hosts are denied access.
Order Deny,Allow
Deny from all
Allow from apache.org
In the next example, all hosts in the apache.org domain are allowed access, except for the hosts which are in the foo.apache.org subdomain, who are denied access. All hosts not in the apache.org domain are denied access because the default state is to deny access to the server.
Order Allow,Deny
Allow from apache.org
Deny from foo.apache.org
On the other hand, if the Order in the last example is changed to Deny,Allow, all hosts will be allowed access. This happens because, regardless of the actual ordering of the directives in the configuration file, the Allow from apache.org will be evaluated last and will override the Deny from foo.apache.org. All hosts not in the apache.org domain will also be allowed access because the default state will change to allow.
The presence of an Order directive can affect access to a part of the server even in the absence of accompanying Allow and Deny directives because of its effect on the default access state. For example,
Order Allow,Deny
will deny all access to the /www directory because the default access state will be set to deny.
The Order directive controls the order of access directive processing only within each phase of the server's configuration processing. This implies, for example, that an Allow or Deny directive occurring in a section will always be evaluated after an Allow or Deny directive occurring in a section or .htaccess file, regardless of the setting of the Order directive. For details on the merging of configuration sections, see the documentation on How Directory, Location and Files sections work.
See also: Deny and Allow.
|
]
| | | | | |