#!/bin/bash
block_list_file="/etc/block_list.txt"
if [ ! -f $block_list_file ]; then touch $block_list_file fi
timestamp=`date +%s`
while read line; do ip=`echo $line | awk '{print $1}'` last_block_time=`echo $line | awk '{print $2}'`
if [ $((timestamp-last_block_time)) -gt 3600 ]; then /sbin/iptables -A INPUT -s $ip -j DROP sed -i "s/${ip}.*/${ip} ${timestamp}/g" $block_list_file fi done < $block_list_file
|