diff options
-rw-r--r-- | util/Makefile | 2 | ||||
-rw-r--r-- | util/antispam.c | 122 | ||||
-rw-r--r-- | util/killdeadbbs.c | 56 | ||||
-rw-r--r-- | util/lunar-1,15run.pl | 11 | ||||
-rw-r--r-- | util/testkenben.txt | 11 |
5 files changed, 1 insertions, 201 deletions
diff --git a/util/Makefile b/util/Makefile index 99461ffe..99ff62af 100644 --- a/util/Makefile +++ b/util/Makefile @@ -26,7 +26,7 @@ CPROG_WITH_UTIL= \ # ¤U±³o¨Çµ{¦¡, ·|ª½±µ³Q compile CPROG_WITHOUT_UTIL= \ - shmsweep uhash_loader showboard antispam \ + shmsweep uhash_loader showboard \ countalldice webgrep bbsrf initbbs \ userlist tunepasswd buildir merge_passwd \ merge_board xchatd bbsmail diff --git a/util/antispam.c b/util/antispam.c deleted file mode 100644 index e5b2ed59..00000000 --- a/util/antispam.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $Id$ */ -/* §ì¼s§i«Hªºµ{¦¡ */ -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include "config.h" - -#define WINDOW 100 /* ¤@¦¸window¦h¤ÖÓserver */ -#define LEVEL 21 /* Y´X¦¸«´_´Nºâ¼s§i«H */ - -#define mailog BBSHOME "/etc/mailog" -#define spamlog BBSHOME "/etc/spam" - -typedef struct sendinfo -{ - char time[18]; - char from[50]; - char userid[20]; - int count; -} -sendinfo; - -int -main(int argc, char **argv) -{ - char buf[200], *from, *userid; - int num = -1, numb = -1, n, nb; - FILE *fp = fopen(mailog, "r"), *fo; - sendinfo data[WINDOW]; - sendinfo bad[WINDOW]; - - unlink(spamlog); - fo = fopen(spamlog, "a"); - memset(data, 0, sizeof(data)); - memset(bad, 0, sizeof(bad)); - - if (!fp || !fo) - return 0; - - while (fgets(buf, 200, fp)) - { - strtok(buf, "\r\n"); - from = strchr(buf, '>') + 2; - userid = strstr(buf, " =>"); - - if (!from || !userid) - continue; - - *userid = 0; - userid += 4; - - if (strstr(from, "MAILER-DAEMON") - || strstr(from, userid)) - continue; /* °h«H³qª¾¤£ºÞ */ - /* ¬O§_¤w¬Obadhost */ - - for (nb = 0; nb < WINDOW && bad[nb].from[0]; nb++) - if (!strcmp(bad[nb].from, from)) - break; - - if (nb < WINDOW && bad[nb].from[0]) - { - bad[nb].count++; - continue; - } - - /* ²¬d¹L¥h°O¿ý */ - - for (n = 0; n < WINDOW && data[n].from[0]; n++) - if (!strcmp(data[n].from, from)) - break; - - if (n < WINDOW && data[n].from[0]) - { - if (!strncmp(data[n].userid, userid, 20)) - continue; - /* Â൹¦P¤@Ó¤H´N¤£ºÞ */ - strncpy(data[n].userid, userid, 20); - if (++data[n].count >= LEVEL) - { - /* Åܦ¨bad ²¾data¨ìbad ªÅ¯Ê¥Ñ«á¤@µ§¸ê®Æ¸É¤W */ - if (nb >= WINDOW) - { - numb = (numb + 1) % WINDOW; - nb = numb; - fprintf(fo, "%s %s «ÂбH %d ¦¸\n", - bad[nb].time, bad[nb].from, bad[nb].count); -/* printf(" %s send %d times\n", - bad[nb].from, bad[nb].count); */ - } - memcpy(&bad[nb], &data[n], sizeof(sendinfo)); - memcpy(&data[n], &data[n + 1], sizeof(sendinfo) * (WINDOW - n - 1)); - if (num > n) - num--; - } - } - else - { - if (n >= WINDOW) - { - num = (num + 1) % WINDOW; - n = num; - } -/* printf("[%s] to [%s]\n", from, userid); */ - buf[17] = 0; - strncpy(data[n].time, buf, 17); - strncpy(data[n].from, from, 50); - strncpy(data[n].userid, userid, 20); - } - } - - for (nb = 0; nb < WINDOW && bad[nb].from[0]; nb++) - { - fprintf(fo, "%s %s «ÂбH %d ¦¸\n", bad[nb].time, - bad[nb].from, bad[nb].count); -/* printf(" %s send %d times\n", bad[nb].from, bad[nb].count); */ - } - fclose(fp); - fclose(fo); - return 0; -} diff --git a/util/killdeadbbs.c b/util/killdeadbbs.c deleted file mode 100644 index 0c83fe29..00000000 --- a/util/killdeadbbs.c +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef FreeBSD -int main(int argc, char **argv) -{ - puts("this program is only for FreeBSD"); -} -#else -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <signal.h> -#include <kvm.h> -#include <fcntl.h> -#include <limits.h> -#include <sys/param.h> -#include <sys/sysctl.h> -#include <sys/user.h> -#include "config.h" // for BBSUID - -int main(int argc, char **argv) -{ - kvm_t *kd; - struct kinfo_proc *kp; - char errbuf[_POSIX2_LINE_MAX]; - int nentries, i, npids; - pid_t pids[8192]; - kd = kvm_openfiles("/dev/null", "/dev/null", NULL, O_RDONLY, errbuf); - if( kd == NULL ) - errx(1, "%s", errbuf); - - if ((kp = kvm_getprocs(kd, KERN_PROC_UID, BBSUID, &nentries)) == 0 || - nentries < 0) - errx(1, "%s", kvm_geterr(kd)); - - for( npids = 0, i = nentries ; --i >= 0 ; ++kp ){ - if( strncmp(kp->ki_comm, "mbbsd", 5) == 0 ){ - if( kp->ki_runtime > (60 * 1000000) ){ // 60 secs - kill(kp->ki_pid, 1); - pids[npids++] = kp->ki_pid; - printf("%d\n", kp->ki_pid); - } - } - } - - if( npids != 0 ){ - sleep(2); - while( --npids >= 0 ) - kill(pids[npids], 9); - } - - kvm_close(kd); - return 0; -} - -#endif diff --git a/util/lunar-1,15run.pl b/util/lunar-1,15run.pl deleted file mode 100644 index d4cd2f20..00000000 --- a/util/lunar-1,15run.pl +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -use lib '/home/bbs/bin/'; -use LocalVars; -# ¨C¹A¾äªì¤@, ¤Q¤´N·|¶]¤@¦¸ $ARGV[0] -# ¸ê®Æ¨Ó·½ http://tw.weathers.yahoo.com/ -open FH, "$LYNX -source http://tw.weathers.yahoo.com/ | grep '¥Á°ê'|"; -$din = <FH>; -close FH; - -($month, $day) = $din =~ /¹A¾ä (.*?)¤ë (.*?)¤é/; -system("@ARGV") if( $day eq '¤@' || $day eq '¤@¤Q¤' ); diff --git a/util/testkenben.txt b/util/testkenben.txt deleted file mode 100644 index df3893d3..00000000 --- a/util/testkenben.txt +++ /dev/null @@ -1,11 +0,0 @@ -HCGH-306 ¦Ë¤k ¡·¦³¤K¨ö¡I¡I¡I 7/24 jennywen/molly -Foolshome ¹ÎÅé ¡·CCC~~~¤dÁH¦~ 1/14 truth/citizen/nathon -KHCHS-87-306·s²ø ¡·³£¶]¨ìþ¸Ì¥h¤F 6/12 -TGHS8714 «n¤k ¡·²z©Ê¤Ñ®ð¡F·P©Ê¥ 8/07 grassflying/EPOCH -PttDoc ¼Tù ¡·Ptt Document Pr 8/07 -Delphi µ{³] ¡·Delphi¨g·Q¦± 3/09 cying -ciacia_Her ¥xÆW ¡·ciacia¥Î¤å¦r¬D³ 8/16 sherbet -CS87Love ¤¤¤s ¡··R©O! 8/08 sylna/fancydream -Wanfang ¥xÆW ¡·´Nȱo¤F·R¸UªÚ 8/07 zkkk -KS87-308 ¶¯¤¤ ¡´¶¯¤¤¤K±¾¯Z¡m¤@¤ 8/07 SBT/shouhou - |