|
|
|
|
@ -324,7 +324,10 @@ func blockIP(ip string, logger *log.Logger) { |
|
|
|
|
logger.Printf("Error redirecting IP %s to banner service: %v", ip, err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
logger.Printf("Blocking IP: %s", ip) |
|
|
|
|
// Delay for 3 seconds before executing the command
|
|
|
|
|
time.Sleep(3 * time.Second) |
|
|
|
|
|
|
|
|
|
logger.Printf("Blocking IP: %s", ip) |
|
|
|
|
cmd = exec.Command("sudo", "iptables", "-A", "INPUT", "-s", ip, "-j", "DROP") |
|
|
|
|
if err := cmd.Run(); err != nil { |
|
|
|
|
logger.Printf("Error blocking IP %s: %v", ip, err) |
|
|
|
|
|