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