mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-13 22:20:59 +00:00
v0.9.4. Short names for ipsets
This commit is contained in:
@@ -8,9 +8,9 @@ LUA_MODULE=1
|
||||
LUCI_APP=1
|
||||
|
||||
OWRT_VERSION="current"
|
||||
RUAB_VERSION="0.9.3-0"
|
||||
RUAB_MOD_LUA_VERSION="0.9.3-0"
|
||||
RUAB_LUCI_APP_VERSION="0.9.3-0"
|
||||
RUAB_VERSION="0.9.4-0"
|
||||
RUAB_MOD_LUA_VERSION="0.9.4-0"
|
||||
RUAB_LUCI_APP_VERSION="0.9.4-0"
|
||||
BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master"
|
||||
PKG_DIR="/tmp"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=0.9.3-0
|
||||
PKG_VERSION:=0.9.4-0
|
||||
LUCI_TITLE:=LuCI support for ruantiblock
|
||||
LUCI_DEPENDS:=+ruantiblock
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -113,18 +113,18 @@ return view.extend({
|
||||
'id': 'last_blacklist_update.date' },
|
||||
data.last_blacklist_update.date),
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td left' }, 'IP:'),
|
||||
E('td', { 'class': 'td left',
|
||||
'id': 'last_blacklist_update.ip' },
|
||||
data.last_blacklist_update.ip),
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td left' }, 'CIDR:'),
|
||||
E('td', { 'class': 'td left',
|
||||
'id': 'last_blacklist_update.cidr' },
|
||||
data.last_blacklist_update.cidr),
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td left' }, 'IP:'),
|
||||
E('td', { 'class': 'td left',
|
||||
'id': 'last_blacklist_update.ip' },
|
||||
data.last_blacklist_update.ip),
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td left' }, 'FQDN:'),
|
||||
E('td', { 'class': 'td left',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ruantiblock-mod-lua
|
||||
PKG_VERSION:=0.9.3
|
||||
PKG_VERSION:=0.9.4
|
||||
PKG_RELEASE:=0
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@ end
|
||||
|
||||
function BlackListParser:write_update_status()
|
||||
local file_handler = assert(io.open(self.UPDATE_STATUS_FILE, "w"), "Could not open 'update_status' file")
|
||||
file_handler:write(string.format("%d %d %d", self.ip_records_count, self.cidr_count, self.fqdn_records_count))
|
||||
file_handler:write(string.format("%d %d %d", self.cidr_count, self.ip_records_count, self.fqdn_records_count))
|
||||
file_handler:close()
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ruantiblock-mod-py
|
||||
PKG_VERSION:=0.9.3
|
||||
PKG_VERSION:=0.9.4
|
||||
PKG_RELEASE:=0
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ class WriteConfigFiles(Config):
|
||||
def write_update_status_file(self, ip_count, cidr_count, output_fqdn_count):
|
||||
with open(self.UPDATE_STATUS_FILE, "wt") as file_handler:
|
||||
file_handler.write(
|
||||
f"{ip_count} {cidr_count} {output_fqdn_count}")
|
||||
f"{cidr_count} {ip_count} {output_fqdn_count}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ruantiblock
|
||||
PKG_VERSION:=0.9.3
|
||||
PKG_VERSION:=0.9.4
|
||||
PKG_RELEASE:=0
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Info() {
|
||||
if(NF < 4)
|
||||
print "\"status\":false";
|
||||
else
|
||||
print "\"status\":true,\"date\":\""$4"\",\"ip\":\""$1"\",\"cidr\":\""$2"\",\"fqdn\":\""$3"\"";
|
||||
print "\"status\":true,\"date\":\""$4"\",\"cidr\":\""$1"\",\"ip\":\""$2"\",\"fqdn\":\""$3"\"";
|
||||
}' "$UPDATE_STATUS_FILE"
|
||||
else
|
||||
printf "\"status\":false"
|
||||
@@ -25,7 +25,7 @@ Info() {
|
||||
printf "\"_dummy\":false},";
|
||||
}'
|
||||
printf "\"ipset\":{";
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP" "$IPSET_DNSMASQ" "$IPSET_ONION"
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_ONION" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP" "$IPSET_DNSMASQ"
|
||||
do
|
||||
$IPSET_CMD list "$_set" -terse | $AWK_CMD -F ": " '
|
||||
{
|
||||
|
||||
@@ -185,13 +185,13 @@ if [ $ENABLE_LOGGING = "1" -a $? -ne 0 ]; then
|
||||
fi
|
||||
LOGGER_PARAMS="-t `basename $0` -p user.notice"
|
||||
export IP_DATA_FILE="${DATA_DIR}/${NAME}.ip"
|
||||
export IPSET_ALLOWED_HOSTS="${NAME}_allowed_ip"
|
||||
export IPSET_IP="${NAME}_ip"
|
||||
export IPSET_IP_TMP="${IPSET_IP}_tmp"
|
||||
export IPSET_CIDR="${NAME}_cidr"
|
||||
export IPSET_CIDR_TMP="${IPSET_CIDR}_tmp"
|
||||
export IPSET_DNSMASQ="${NAME}_dnsmasq"
|
||||
export IPSET_ONION="${NAME}_onion"
|
||||
export IPSET_ALLOWED_HOSTS="r_allowed_ip"
|
||||
export IPSET_ONION="r_onion"
|
||||
export IPSET_CIDR="rc"
|
||||
export IPSET_CIDR_TMP="${IPSET_CIDR}t"
|
||||
export IPSET_IP="ri"
|
||||
export IPSET_IP_TMP="${IPSET_IP}t"
|
||||
export IPSET_DNSMASQ="rd"
|
||||
export UPDATE_STATUS_FILE="${DATA_DIR}/update_status"
|
||||
UPDATE_PID_FILE="/var/run/${NAME}_update.pid"
|
||||
START_PID_FILE="/var/run/${NAME}_start.pid"
|
||||
@@ -422,7 +422,7 @@ GetDataFiles() {
|
||||
AddUserEntries
|
||||
if [ $_return_code -eq 0 ]; then
|
||||
_update_string=`$AWK_CMD '{
|
||||
printf "Received entries: %s\n", (NF < 3) ? "No data" : "IP: "$1", CIDR: "$2", FQDN: "$3;
|
||||
printf "Received entries: %s\n", (NF < 3) ? "No data" : "CIDR: "$1", IP: "$2", FQDN: "$3;
|
||||
exit;
|
||||
}' "$UPDATE_STATUS_FILE"`
|
||||
### STDOUT
|
||||
@@ -564,7 +564,7 @@ Status() {
|
||||
printf "\n \033[1m${NAME} status\033[m: \033[1;32mEnabled\033[m\n\n PROXY_MODE: ${PROXY_MODE}\n PROXY_LOCAL_CLIENTS: ${PROXY_LOCAL_CLIENTS}\n BLLIST_MODULE: ${BLLIST_MODULE}\n"
|
||||
if [ -f "$UPDATE_STATUS_FILE" ]; then
|
||||
$AWK_CMD '{
|
||||
update_string=(NF < 4) ? "No data" : $4" (IP: "$1" | CIDR: "$2" | FQDN: "$3")";
|
||||
update_string=(NF < 4) ? "No data" : $4" (CIDR: "$1" | IP: "$2" | FQDN: "$3")";
|
||||
printf "\n Last blacklist update: %s\n", update_string;
|
||||
}' "$UPDATE_STATUS_FILE"
|
||||
else
|
||||
@@ -581,7 +581,7 @@ Status() {
|
||||
};
|
||||
}'
|
||||
printf " \033[4mIp sets\033[m:\n\n"
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP" "$IPSET_DNSMASQ" "$IPSET_ONION"
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_ONION" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP" "$IPSET_DNSMASQ"
|
||||
do
|
||||
$IPSET_CMD list "$_set" -terse | $AWK_CMD -F ":" '
|
||||
{
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 136 KiB |
Reference in New Issue
Block a user