#!/usr/local/bin/ruby ip = ARGV[0] raise "Pass in an IP" if !ip `/sbin/service denyhosts stop` data = File.read("/etc/hosts.deny").split("\n") File.open("/etc/hosts.deny", "w") do |f| data.each do |line| f.syswrite(line + "\n") unless line =~ /#{ip}/ end end `echo "#{ip}" >> /usr/share/denyhosts/data/allowed-hosts` `/sbin/service denyhosts start`