The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 Re: Adding blocked hosts to multiple systems
Author: Jeff Pabian 
Date:   23-01-02 07:54

And us "at" to remove the routes after X amount of time. I have a perk script that adds blackholes IP's, and creates an atjob to remove them after 8 hours. The perl script also checks the IP address against the existing route table, and if it's already in there, then it does nothing. But... if anyone is interested in the atjob part, here's the function that does it:

sub at_job ($){
my ($ip) = @_;
#open ATJOB,"|$AT \"now+3hours\" > /dev/null 2>&1 " || die "Can't open $AT: $!";
open ATJOB,"|$AT \"now+".$hours."hours\" > /dev/null 2>&1 " || die "Can't open $AT: $!";
print ATJOB "$ROUTE delete -blackhole $ip 127.0.0.1\n";
close ATJOB || die "Can't close $AT: $!";
}

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 Adding blocked hosts to multiple systems   new
el_kab0ng 22-01-02 01:10 
 Re: Adding blocked hosts to multiple systems   new
el_kab0ng 22-01-02 01:13 
 Re: Adding blocked hosts to multiple systems   new
el_kab0ng 22-01-02 01:17 
 Re: Adding blocked hosts to multiple systems   new
william cooper 22-01-02 15:00 
 Re: Adding blocked hosts to multiple systems   new
el_kab0ng 22-01-02 20:06 
 Re: Adding blocked hosts to multiple systems   new
Jeff Pabian 23-01-02 07:54 
 Re: Adding blocked hosts to multiple systems   new
Jeff Pabian 23-01-02 07:55 
 Re: Adding blocked hosts to multiple systems   new
Sunil 02-02-02 05:04 
 Re: Adding blocked hosts to multiple systems   new
el_kab0ng 12-04-02 16:25 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org