Plan 9 from Bell Labs’s /usr/web/sources/contrib/someone/root/rc/bin/badguy

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# badguy ip... - add ip addresses of bad guys to /sys/lib/badips
cd /sys/lib
chmod +l badips.lock >>badips.lock		# for first time
{
	for (ip) {
		if (~ $ip *.*.*.* && ! ~ $ip 96.78.174.* && ! ~ $ip 10.*)
			echo $ip >>badips
		if not
			echo $0: $ip: illegal bad-guy ipv4 addr >[1=2]
	}
# don't race with smtpd, which adds impatient spammers
#	chmod -a badips
#	sort -u badips | sort -o badips -t. +0n -1 +1n -2 +2n -3 +3n
	chmod +a badips
} >>badips.lock

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.