From a18be7b8a613125646ba8c7cdfa0309e96ff9412 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 25 Jun 2014 13:22:05 -0700 Subject: Summer 2014 update. * apache.txr: restructuring of matching rules. Some new intruders listed. Now also checks HTTP response code to detect accesses to nonexistent pages. Bugfix: was not calling do-expiry. * txrban.txr: added code at top of @(do) to easily turn off daemonization and redirect logging to stdout for debugging. (*extrainfo*): New global hash. (report): New optional argument to pass extra info. (get-info): Function to retrieve the list of extra info for an IP address. (clear): New function to unban an IP and completely clear its access history. (ban): Use new sh function instead of open-command. Use new backquote operator ^ instead of '. (process-histories): When the recent access history is empty, delete it from *access-hist* rather than keeping an empty list there. Also delete the *extrainfo* when this happens. (do-expiry): Use unban function for unbanning. (unban): New function. * utils.txr (m): New pattern function for parsing month name. (self): New variable to hold the script's own name. (debug): Send output to *stdlog* instead of *stdout*, so that we now have syslog logging. * exim.txr: New file. * ssh.txr: New file. * startup.sh: New file. --- utils.txr | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'utils.txr') diff --git a/utils.txr b/utils.txr index ca8e256..a572aeb 100644 --- a/utils.txr +++ b/utils.txr @@ -1,8 +1,20 @@ @(define n (a))@(local n)@{n /\d+/}@(bind a @(int-str n))@(end) +@(define m (a))@(local m)@{m /\w+/}@(bind a @(month-num m))@(end) +@# +@(next :string @(identity *self-path*)) +@(some) +@*nil/@self.@nil +@(or) +@*nil/@self +@(or) +@self.@nil +@(or) +@self +@(end) @# @(do (defun debug (arg . args) - [apply format '(t ,arg ,*args)]) + [apply format ^(, *stdlog* ,arg ,*args)]) (defun hrtime (time) (cond -- cgit v1.2.3