(flat (map log-lines (directory "activity" (log-name-fmt t)))))
# Translate timestamp into its local time (hour minute), if it's
-# within the applicable open time, null otherwise.
+# within the applicable day, null otherwise.
(define (period-minute x)
(when x
(letn ((d (date-list (+ (int x 0 10) (* 60 (now 0 -2)))))
(tm (3 2 d))
(on (if (regex "^[0-9]+ ([0-9]+)$" x 0) (> (int $1 0 10) CLIP) 1))
)
- (and on (= (0 3 d) DAY) (>= tm START) (< tm END) tm))))
+ (and on (= (0 3 d) DAY) tm)))) ; (>= tm START) (< tm END) tm))))
# Collect all mentioned minutes from the activity logs
(setf TOTAL
--- /dev/null
+; Updated at Sun Aug 8 22:53:01 2021
+((control "ipset-control.lsp")
+ (gap 10)
+ (clip 1000)
+ (1 timed (5 30) (2 0) (20 0))
+ (2 timed (7 30) (1 0) (20 0))
+ (3 timed (7 30) (1 0) (20 0))
+ (4 timed (7 30) (1 0) (20 0))
+ (5 timed (7 30) (3 0) (22 0))
+ (6 timed (7 30) (1 0) (20 0))
+ (7 timed (7 30) (1 0) (20 0))
+ )
end-options '()
limit-options '()
)
-(dotimes (h 23) (dolist (m '(0 30))
+(dotimes (h 24) (dolist (m '(0 30))
(push (format "%02d:%02d" h m) start-options -1)))
-(dotimes (h 23) (dolist (m '(0 30))
+(dotimes (h 24) (dolist (m '(0 30))
(push (format "%02d:%02d" h m) end-options -1)))
(for (h 1 8) (dolist (m '(0 30))
(push (format "%02d:%02d" h m) limit-options -1)))
--- /dev/null
+#!/bin/bash
+
+( nohup newlisp -http -d 1070 -w manager/www & )
CMD=${1-start}
NET=192.168.249
TAP=tap0
+SET=TIMO
cd $(dirname $0)
RULE=( ! -o $TAP -j TEE --gateway $NET.2 --oif $TAP )
case "$CMD" in
start)
+ # start the blocking rule
+ if iptables-save | grep -qs "match-set $SET" ; then
+ : # all fine
+ else
+ if ipset list $SET >& /dev/null ; then
+ : # The set exists
+ else
+ ipset create $SET hash:net
+ fi
+ iptables -A FORWARD -p tcp --dport 53 -j ACCEPT
+ iptables -A FORWARD -p udp --dport 53 -j ACCEPT
+ iptables -A FORWARD -m set --match-set $SET src -j DROP
+ fi
+ # Start the traffic listener
if ifconfig $TAP >& /dev/null ; then
echo "Already started"
else
echo $TAP not up yet
done
ifconfig $TAP $NET.1 up
+ iptables -t mangle -A FORWARD -p tcp --dport 53 -j RETURN
+ iptables -t mangle -A FORWARD -p udp --dport 53 -j RETURN
iptables -t mangle -A FORWARD ${RULE[@]}
fi
;;
else
echo "Already stopped"
fi
+ ipset flush $SET
;;
*)
echo "Unknown: $CMD"