v0.9.5. Changes for rublacklist API v3

This commit is contained in:
gSpot
2022-12-25 19:45:07 +03:00
parent 06131d3aca
commit 83918288f1
9 changed files with 34 additions and 26 deletions
+3 -3
View File
@@ -8,9 +8,9 @@ LUA_MODULE=1
LUCI_APP=1 LUCI_APP=1
OWRT_VERSION="current" OWRT_VERSION="current"
RUAB_VERSION="0.9.4-1" RUAB_VERSION="0.9.5-0"
RUAB_MOD_LUA_VERSION="0.9.4-1" RUAB_MOD_LUA_VERSION="0.9.5-0"
RUAB_LUCI_APP_VERSION="0.9.4-1" RUAB_LUCI_APP_VERSION="0.9.5-0"
BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master" BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master"
PKG_DIR="/tmp" PKG_DIR="/tmp"
+1 -1
View File
@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_VERSION:=0.9.4-1 PKG_VERSION:=0.9.5-0
LUCI_TITLE:=LuCI support for ruantiblock LUCI_TITLE:=LuCI support for ruantiblock
LUCI_DEPENDS:=+ruantiblock LUCI_DEPENDS:=+ruantiblock
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
+2 -2
View File
@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock-mod-lua PKG_NAME:=ruantiblock-mod-lua
PKG_VERSION:=0.9.4 PKG_VERSION:=0.9.5
PKG_RELEASE:=1 PKG_RELEASE:=0
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@@ -182,9 +182,9 @@ local iconv = prequire("iconv")
local si, it local si, it
if prequire("bit") then if prequire("bit") then
it = prequire("iptool") it = require("iptool")
if it then if it then
si = prequire("ruab_sum_ip") si = require("ruab_sum_ip")
end end
end end
if not si then if not si then
@@ -509,14 +509,14 @@ end
local Rbl = Class(BlackListParser, { local Rbl = Class(BlackListParser, {
url = Config.RBL_ALL_URL, url = Config.RBL_ALL_URL,
records_separator = '%{"authority": ',
ips_separator = ", ", ips_separator = ", ",
ip_string_pattern = "([a-f0-9/.:]+),?\n?",
}) })
function Rbl:sink() function Rbl:sink()
return function(chunk) return function(chunk)
if chunk and chunk ~= "" then if chunk and chunk ~= "" then
for ip_str, fqdn_str in chunk:gmatch("%[([a-f0-9/.:', ]+)%],([^,]-),.-" .. self.records_separator .. "?") do for fqdn_str, ip_str in chunk:gmatch('"domains": %["?(.-)"?%].-"ips": %[([a-f0-9/.:", ]*)%].-' .. self.records_separator .. "?") do
fqdn_sink_func(self, ip_str, fqdn_str) fqdn_sink_func(self, ip_str, fqdn_str)
end end
end end
@@ -526,6 +526,8 @@ end
local RblIp = Class(Rbl, { local RblIp = Class(Rbl, {
url = Config.RBL_IP_URL, url = Config.RBL_IP_URL,
records_separator = ",",
ip_string_pattern = "([a-f0-9/.:]+)",
sink = ip_sink, sink = ip_sink,
}) })
@@ -533,7 +535,6 @@ local RblIp = Class(Rbl, {
local Zi = Class(BlackListParser, { local Zi = Class(BlackListParser, {
url = Config.ZI_ALL_URL, url = Config.ZI_ALL_URL,
ip_string_pattern = "([a-f0-9%.:/ |]+);.-\n",
site_encoding = Config.ZI_ENCODING, site_encoding = Config.ZI_ENCODING,
}) })
@@ -549,6 +550,7 @@ function Zi:sink()
end end
local ZiIp = Class(Zi, { local ZiIp = Class(Zi, {
ip_string_pattern = "([a-f0-9%.:/ |]+);.-\n",
sink = ip_sink, sink = ip_sink,
}) })
@@ -556,7 +558,6 @@ local ZiIp = Class(Zi, {
local Af = Class(BlackListParser, { local Af = Class(BlackListParser, {
url = Config.AF_FQDN_URL, url = Config.AF_FQDN_URL,
ip_string_pattern = "(.-)\n",
}) })
function Af:sink() function Af:sink()
@@ -573,6 +574,7 @@ end
local AfIp = Class(Af, { local AfIp = Class(Af, {
url = Config.AF_IP_URL, url = Config.AF_IP_URL,
ip_string_pattern = "(.-)\n",
sink = ip_sink, sink = ip_sink,
BLLIST_MIN_ENTRIES = 100, BLLIST_MIN_ENTRIES = 100,
}) })
+2 -2
View File
@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock-mod-py PKG_NAME:=ruantiblock-mod-py
PKG_VERSION:=0.9.4 PKG_VERSION:=0.9.5
PKG_RELEASE:=2 PKG_RELEASE:=0
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@@ -372,14 +372,16 @@ class RblFQDN(BlackListParser):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.url = self.RBL_ALL_URL self.url = self.RBL_ALL_URL
self.fields_separator = "]," self.records_separator = '{"authority": '
self.ips_separator = "," self.ips_separator = ", "
def parser_func(self): def parser_func(self):
for entry in self._split_entries(): for entry in self._split_entries():
entry_list = entry.partition(self.fields_separator) res = re.search(r'"domains": \["?(.*?)"?\].*?"ips": \[([a-f0-9/.:", ]*)\]', entry)
ip_string = re.sub(r"[' \]\[]", "", entry_list[0]) if not res:
fqdn_string = re.sub(",.*$", "", entry_list[2]) continue
ip_string = res.group(2).replace('"', "")
fqdn_string = res.group(1)
if fqdn_string: if fqdn_string:
try: try:
self.fqdn_field_processing(fqdn_string) self.fqdn_field_processing(fqdn_string)
@@ -393,10 +395,11 @@ class RblIp(BlackListParser):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.url = self.RBL_IP_URL self.url = self.RBL_IP_URL
self.records_separator = ","
def parser_func(self): def parser_func(self):
for entry in self._split_entries(): for entry in self._split_entries():
self.ip_field_processing(entry.rstrip(",")) self.ip_field_processing(re.sub(r'[\[\]" ]', "", entry))
class ZiFQDN(BlackListParser): class ZiFQDN(BlackListParser):
@@ -450,6 +453,7 @@ class AfIp(BlackListParser):
for entry in self._split_entries(): for entry in self._split_entries():
self.ip_field_processing(entry) self.ip_field_processing(entry)
class RaFQDN(BlackListParser): class RaFQDN(BlackListParser):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@@ -474,6 +478,7 @@ class RaFQDN(BlackListParser):
self.download_config(self.url_stat, self.UPDATE_STATUS_FILE) self.download_config(self.url_stat, self.UPDATE_STATUS_FILE)
return 0 return 0
class RaIp(RaFQDN): class RaIp(RaFQDN):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@@ -481,6 +486,7 @@ class RaIp(RaFQDN):
self.url_dnsmasq = self.RA_IP_DMASK_URL self.url_dnsmasq = self.RA_IP_DMASK_URL
self.url_stat = self.RA_IP_STAT_URL self.url_stat = self.RA_IP_STAT_URL
class WriteConfigFiles(Config): class WriteConfigFiles(Config):
def __init__(self): def __init__(self):
self.write_buffer = -1 self.write_buffer = -1
+2 -2
View File
@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock PKG_NAME:=ruantiblock
PKG_VERSION:=0.9.4 PKG_VERSION:=0.9.5
PKG_RELEASE:=1 PKG_RELEASE:=0
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@@ -96,8 +96,8 @@ BLLIST_ALT_NSLOOKUP=0
BLLIST_ALT_DNS_ADDR="8.8.8.8" BLLIST_ALT_DNS_ADDR="8.8.8.8"
### Источники блэклиста ### Источники блэклиста
RBL_ALL_URL="https://reestr.rublacklist.net/api/v2/current/csv/" RBL_ALL_URL="https://reestr.rublacklist.net/api/v3/snapshot/"
RBL_IP_URL="https://reestr.rublacklist.net/api/v2/ips/csv/" RBL_IP_URL="https://reestr.rublacklist.net/api/v3/ips/"
ZI_ALL_URL="https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv" ZI_ALL_URL="https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv"
#ZI_ALL_URL="https://app.assembla.com/spaces/z-i/git/source/master/dump.csv?_format=raw" #ZI_ALL_URL="https://app.assembla.com/spaces/z-i/git/source/master/dump.csv?_format=raw"
AF_IP_URL="https://antifilter.download/list/allyouneed.lst" AF_IP_URL="https://antifilter.download/list/allyouneed.lst"
+2 -2
View File
@@ -110,8 +110,8 @@ export BLLIST_ALT_NSLOOKUP=0
export BLLIST_ALT_DNS_ADDR="8.8.8.8" export BLLIST_ALT_DNS_ADDR="8.8.8.8"
### Источники блэклиста ### Источники блэклиста
export RBL_ALL_URL="https://reestr.rublacklist.net/api/v2/current/csv/" export RBL_ALL_URL="https://reestr.rublacklist.net/api/v3/snapshot/"
export RBL_IP_URL="https://reestr.rublacklist.net/api/v2/ips/csv/" export RBL_IP_URL="https://reestr.rublacklist.net/api/v3/ips/"
export ZI_ALL_URL="https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv" export ZI_ALL_URL="https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv"
export AF_IP_URL="https://antifilter.download/list/allyouneed.lst" export AF_IP_URL="https://antifilter.download/list/allyouneed.lst"
export AF_FQDN_URL="https://antifilter.download/list/domains.lst" export AF_FQDN_URL="https://antifilter.download/list/domains.lst"