[Plugin] IP Blocker

Dravu

Verified User
Joined
Sep 9, 2007
Messages
307
I noticed that there was a commercial IP Deny Manager as well as an IP Blocker that was based off the Hotlink blocker (that unfortunately had a limit of 1 IP Address), so I decided I'd make a free one of my own from the ground up as I've been wanting to learn how to use the Plugin System anyways. This, like the others, simply adds onto your .htaccess file. It has beginning and ending comment tags that it uses, so it should be safe with anything else you have in there. Tell me if any problems come up. I think I worked out all the bugs, but you never know.


Version 1.8:
- Changed a few things to make the script backwards compatible with PHP4
- Made it display errors if the .htaccess isn't writeable or if the entries were incorrect
- Added the ability to block blocks of IPs ("192.168." to block all IPs from 192.168.###.###) as well as domain names (for blocking ISPs and such)
- Removed the check for invalid IPs. Now it only checks that the entry is at least 5 characters long. Be careful.
http://dravu.com/directadmin/ipblocker.tar.gz
http://www.johannesspringer.at/dwnld/ipblocker.1.8.tar.gz

Version 1.7:
- Changed a few functions due to becoming deprecated in PHP 5.3 and PHP 6
http://www.johannesspringer.at/dwnld/ipblocker.1.7.tar.gz
 

Attachments

  • ipblocker1.gif
    ipblocker1.gif
    45.9 KB · Views: 1,164
  • ipblocker2.gif
    ipblocker2.gif
    46.3 KB · Views: 973
  • ipblocker3.gif
    ipblocker3.gif
    3.9 KB · Views: 737
Last edited:
Thanks for this, there should be more free plugins :D im gonna test it this weekend if time permits.
 
Thanks for this, there should be more free plugins :D im gonna test it this weekend if time permits.
Thanks. :) I'll probably make more. I've just got to get some ideas and create a better structure for it all to make it easier to customize. The Plugin system really is neat though and has many many possibilities for it with all the freedom that John gave. I was actually rather impressed at how simple it was once you figure out how it's all setup. :p
 
Give me 10 years and a couple of headaches and i think i will master it then to write plugins :D
Got way to much on my mind to fully focus on linux / php / plugin writing...

Just installed it, flawlessy no errors.
Now i need to find a target to get blocked.. :D Preferrably someone with a static IP..
 
Last edited:
ipblocker successfully downloaded
Error unpacking /usr/local/directadmin/plugins/ipblocker/plugin.tar.gz : Error restoring file /usr/local/directadmin/plugins/ipblocker/plugin.tar.gz : gzip: stdin: not in gzip format /bin/tar: Child returned status 1 /bin/tar: Error exit delayed from previous errors : tar returned error code 512

No install.sh script was found. Script not executed.
Error with install script
 
ipblocker successfully downloaded
Error unpacking /usr/local/directadmin/plugins/ipblocker/plugin.tar.gz : Error restoring file /usr/local/directadmin/plugins/ipblocker/plugin.tar.gz : gzip: stdin: not in gzip format /bin/tar: Child returned status 1 /bin/tar: Error exit delayed from previous errors : tar returned error code 512

No install.sh script was found. Script not executed.
Error with install script
Apparently there's a bug with dA. You'll have to download the file and then use the option to upload it. When trying to use the URL option, it fails.
 
Does this work on subdomains as well?
Oh and I did like to see a list of IPs blocked so far in its panel :)
 
Does this work on subdomains as well?
Oh and I did like to see a list of IPs blocked so far in its panel :)
The blocked IPs for a domain affect the sub-domains for that domain as well. You can't block IPs for the sub-domains specifically unfortunately, mainly because of how hard and inefficient it would be to do (I wish dA would provide a file with a list of info for each account). Is that what you were asking? :)

Also, was that a typo on the word "did"? If so, then it's mainly because the blocks are domain-based. I suppose it wouldn't be too hard to make a list of all the current IPs getting blocked and for which domains though if you'd like to have it.
 
Last edited:
Yeah it would be a neat little detail :)

Oh yeah, another one, a vital one: Could you make it possible to block certain domains as well?
 
Last edited:
Yeah it would be a neat little detail :)

Oh yeah, another one, a vital one: Could you make it possible to block certain domains as well?
Sorry for the late reply. To add the option to block domains wouldn't be too hard. However, it might be more benefitial for me to just rewrite most of it and change the interface and the structure of coding. Unfortunately, I wasn't sure the exact URL of where I was going to put the file at the time, so I had left the update URL blank (should've double-checked that, but was more focused on the coding at the time). That means, people will have to uninstall the IP Blocker and then install the new version as it won't just update itself when they update DA. I may just put in an option to convert the information to the new system so that nothing's hurt.
 
Well both things work. it is not like previous banned IPs will dissapear when you uninstall your plugin :)
 
Back
Top