Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: create filename from IP#by waswas-fng (Curate) |
on Nov 26, 2003 at 19:22 UTC ( [id://310356]=note: print w/replies, xml ) | Need Help?? |
If you insist on doing this in this way, I would use directory trees to store the login count, meaning for the ip 127.0.0.1 use /var/run/iptracker/127/0/0/1/count this will make the application run much faster than storing a huge number of files in one directory. when you get above a certain number of files in a directory (it differs on platform/version) you will see a _HUGE_ slowdown when stating files and opening files in said directory. I would recommend using some type of database or tie hash to store this instead. You get one file with quick lookups and no messy filesystem cleanups to worry about. Also 127.0.0.1 is a proper IP address. -Waswas Edited to add: I agree with ovid that IP/failed login pairing not a very good metric for taking action. Many ISP's are claiming "Speed enhancers" nowadays which is really just a transparent proxy farm set up to grab a page, reduce image size/quality and push on to the requester. So more often than ever your site will be hit by proxy servers -- taking action based on IP is not worthwhile. One of the only things I can see being useful in that arena is to maybe take a rolling average of badauths/ip/time to throttle an attack from a source ip. But even that is hard to do without penalizing good users.
In Section
Seekers of Perl Wisdom
|
|