gods

a simple blocklist for ssh
Log | Files | Refs | README | LICENSE

commit cf13b134ea06e354dec798e99df8a023fe6a897e
parent 98c4949aa2185b3268f95f79f0ff5f9979071659
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Sat, 23 Oct 2021 13:22:36 +0200

Use stderr for printing info/warn.

Diffstat:
Mattack.c | 2+-
Mfw.c | 4++--
Mparser.c | 2+-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/attack.c b/attack.c @@ -74,6 +74,6 @@ int whitelist(struct attacker *a) { /* stub */ - printf("%s whitelisted\n", a->ip); + fprintf(stderr, "%s whitelisted\n", a->ip); return 1; } diff --git a/fw.c b/fw.c @@ -8,7 +8,7 @@ fw_block(char *ip) /* pfctl -t blacklist -T add 123.123.123.123 */ char s[43] = "pfctl -t blacklist -T add "; - printf("fw_block: blocked ip: %s\n", ip); + fprintf(stderr, "fw_block: blocked ip: %s\n", ip); strcat(s, ip); if (system(s) == 127) return 0; @@ -21,7 +21,7 @@ fw_unblock(char *ip) /* pfctl -t blacklist -T delete 123.123.123.123 */ char s[46] = "pfctl -t blacklist -T delete "; - printf("fw_unblock: unblocked ip: %s\n", ip); + fprintf(stderr, "fw_unblock: unblocked ip: %s\n", ip); strcat(s, ip); if (system(s) == 127) return 0; diff --git a/parser.c b/parser.c @@ -292,7 +292,7 @@ parse(char *line, time_t now) lp = line; tp = token; - printf("parse: line: %s\n", lp); + fprintf(stderr, "parse: line: %s\n", lp); if (!timestamp(now)) { fprintf(stderr, "timestamp not found\n"); return -1;