-
Notifications
You must be signed in to change notification settings - Fork 1
/
stats.sh
27 lines (26 loc) · 1.23 KB
/
stats.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
real_list=`grep -B1 "Dynamic Threat List" /config/config.boot | head -n 1 | awk '{print $2}'`
num_items=`/sbin/ipset list $real_list | wc -l`
num_local_pkts=`sudo iptables -vL WAN_LOCAL | grep $real_list | head -n 1 | awk '{print $1}'`
num_in_pkts=`sudo iptables -vL WAN_IN | grep $real_list | head -n 1 | awk '{print $1}'`
num_out_pkts=`sudo iptables -vL WAN_OUT | grep $real_list | head -n 1 | awk '{print $1}'`
echo "IPv4 Stats:"
echo "==========="
echo "#Rules: $num_items"
echo "#WAN_LOCAL: $num_local_pkts"
echo "#WAN_IN: $num_in_pkts"
echo "#WAN_OUT: $num_out_pkts"
real_list=`grep -B1 "Dynamic Threat List IPv6" /config/config.boot | head -n 1 | awk '{print $2}'`
if [ $real_list != "" ]; then
num_items=`/sbin/ipset list $real_list | wc -l`
num_local_pkts=`sudo ip6tables -vL WANv6_LOCAL | grep $real_list | head -n 1 | awk '{print $1}'`
num_in_pkts=`sudo ip6tables -vL WANv6_IN | grep $real_list | head -n 1 | awk '{print $1}'`
num_out_pkts=`sudo ip6tables -vL WANv6_OUT | grep $real_list | head -n 1 | awk '{print $1}'`
echo ""
echo "IPv6 Stats:"
echo "==========="
echo "#Rules: $num_items"
echo "#WAN_LOCAL: $num_local_pkts"
echo "#WAN_IN: $num_in_pkts"
echo "#WAN_OUT: $num_out_pkts"
fi