mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-30 22:30:36 +03:00
Compare commits
3 Commits
v72.202601
...
v72.202601
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a7784878f | ||
|
|
fc3e0ec213 | ||
|
|
9e3dbf8ef3 |
58
.github/workflows/releases.yml
vendored
58
.github/workflows/releases.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflows: ["build"]
|
workflows: ["build"]
|
||||||
types: [completed]
|
types: [completed]
|
||||||
release:
|
release:
|
||||||
types: [published, unpublished, created, edited, deleted, prereleased]
|
types: [published, created, edited]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -25,62 +25,6 @@ jobs:
|
|||||||
ref: gh-pages
|
ref: gh-pages
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Wait for GitHub API consistency (release events)
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
env:
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
ACTION: ${{ github.event.action }}
|
|
||||||
TARGET_ID: ${{ github.event.release.id }}
|
|
||||||
TARGET_NAME: ${{ github.event.release.name }}
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
echo "Release action: $ACTION"
|
|
||||||
echo "Target release id: $TARGET_ID"
|
|
||||||
max=10
|
|
||||||
delay=6
|
|
||||||
check() {
|
|
||||||
curl -s https://api.github.com/repos/$REPO/releases
|
|
||||||
}
|
|
||||||
for iter in $(seq 1 $max); do
|
|
||||||
case "$ACTION" in
|
|
||||||
created)
|
|
||||||
echo "Release created (draft). No API wait needed."
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
published|prereleased)
|
|
||||||
if check | jq "any(.[]; .id == $TARGET_ID)"; then
|
|
||||||
echo "Release appeared in API"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
deleted)
|
|
||||||
if ! check | jq "any(.[]; .id == $TARGET_ID)"; then
|
|
||||||
echo "Release disappeared from API"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
unpublished)
|
|
||||||
if check | jq "any(.[]; .id == $TARGET_ID and .draft == true)"; then
|
|
||||||
echo "Release is now draft"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
edited)
|
|
||||||
if check | jq "any(.[]; .id == $TARGET_ID and .name == \"$TARGET_NAME\")"; then
|
|
||||||
echo "Release updated"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "No consistency wait needed for action: $ACTION"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "Retry $iter/$max..."
|
|
||||||
sleep "$delay"
|
|
||||||
done
|
|
||||||
echo "WARNING: API consistency timeout for action $ACTION"
|
|
||||||
|
|
||||||
- name: Save FULL releases.json
|
- name: Save FULL releases.json
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-zapret
|
PKG_NAME:=luci-app-zapret
|
||||||
PKG_VERSION:=72.20260114
|
PKG_VERSION:=72.20260111
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
'require uci';
|
'require uci';
|
||||||
'require ui';
|
'require ui';
|
||||||
'require view';
|
'require view';
|
||||||
'require view.zapret.tools as tools';
|
'require view.zapret2.tools as tools';
|
||||||
|
|
||||||
const btn_style_neutral = 'btn';
|
const btn_style_neutral = 'btn';
|
||||||
const btn_style_action = 'btn cbi-button-action';
|
const btn_style_action = 'btn cbi-button-action';
|
||||||
@@ -53,6 +53,7 @@ return baseclass.extend({
|
|||||||
} else {
|
} else {
|
||||||
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
|
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
|
||||||
}
|
}
|
||||||
|
wnd.setStage(999);
|
||||||
wnd.appendLog('=========================================================');
|
wnd.appendLog('=========================================================');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ return view.extend({
|
|||||||
|
|
||||||
let btn_diag = create_btn('btn_diag', btn_style_action, _('Diagnostics'));
|
let btn_diag = create_btn('btn_diag', btn_style_action, _('Diagnostics'));
|
||||||
btn_diag.onclick = ui.createHandlerFn(this, () => { diagnost.openDiagnostDialog(this.pkg_arch) });
|
btn_diag.onclick = ui.createHandlerFn(this, () => { diagnost.openDiagnostDialog(this.pkg_arch) });
|
||||||
layout_append('Diagnostic tools', null, [ btn_diag ] );
|
layout_append('', null, [ btn_diag ] );
|
||||||
|
|
||||||
let btn_update = create_btn('btn_update', btn_style_action, _('Update'));
|
let btn_update = create_btn('btn_update', btn_style_action, _('Update'));
|
||||||
btn_update.onclick = ui.createHandlerFn(this, () => { updater.openUpdateDialog(this.pkg_arch) });
|
btn_update.onclick = ui.createHandlerFn(this, () => { updater.openUpdateDialog(this.pkg_arch) });
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
'require view';
|
'require view';
|
||||||
'require view.zapret.tools as tools';
|
'require view.zapret.tools as tools';
|
||||||
|
|
||||||
document.head.appendChild(E('link', {
|
|
||||||
rel: 'stylesheet',
|
|
||||||
href: L.resource('view/zapret/styles.css')
|
|
||||||
}));
|
|
||||||
|
|
||||||
return view.extend({
|
return view.extend({
|
||||||
parsers: { },
|
parsers: { },
|
||||||
|
|
||||||
@@ -133,10 +128,8 @@ return view.extend({
|
|||||||
let btn = sec.taboption(tabname, form.Button, '_' + param + '_btn', locname);
|
let btn = sec.taboption(tabname, form.Button, '_' + param + '_btn', locname);
|
||||||
btn.inputtitle = _('Edit');
|
btn.inputtitle = _('Edit');
|
||||||
btn.inputstyle = 'edit btn';
|
btn.inputstyle = 'edit btn';
|
||||||
let val = sec.taboption(tabname, form.TextValue, '_' + param);
|
let val = sec.taboption(tabname, form.DummyValue, '_' + param);
|
||||||
val.readonly = true;
|
val.rawhtml = multiline ? true : false;
|
||||||
val.rows = rows + 5;
|
|
||||||
val.wrap = false;
|
|
||||||
val.cfgvalue = function(section_id) {
|
val.cfgvalue = function(section_id) {
|
||||||
let value = uci.get(tools.appName, section_id, param);
|
let value = uci.get(tools.appName, section_id, param);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -148,10 +141,15 @@ return view.extend({
|
|||||||
value = value.replace(/\n --/g, "\n--");
|
value = value.replace(/\n --/g, "\n--");
|
||||||
value = value.replace(/ --/g, "\n--");
|
value = value.replace(/ --/g, "\n--");
|
||||||
}
|
}
|
||||||
|
if (val.rawhtml) {
|
||||||
|
value = value.replace(/</g, '˂');
|
||||||
|
value = value.replace(/>/g, '˃');
|
||||||
|
value = value.replace(/\n/g, '<br/>');
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
val.validate = function(section_id, value) {
|
val.validate = function(section_id, value) {
|
||||||
return true;
|
return (value) ? value.trim() : "";
|
||||||
};
|
};
|
||||||
let desc = locname;
|
let desc = locname;
|
||||||
if (multiline == 2) {
|
if (multiline == 2) {
|
||||||
@@ -281,10 +279,6 @@ return view.extend({
|
|||||||
o = s.taboption(tabname, form.Value, 'AUTOHOSTLIST_RETRANS_MAXSEQ', _('RETRANS_MAXSEQ'));
|
o = s.taboption(tabname, form.Value, 'AUTOHOSTLIST_RETRANS_MAXSEQ', _('RETRANS_MAXSEQ'));
|
||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.datatype = 'uinteger';
|
o.datatype = 'uinteger';
|
||||||
|
|
||||||
o = s.taboption(tabname, form.Value, 'AUTOHOSTLIST_RETRANS_RESET', _('RETRANS_RESET'));
|
|
||||||
o.rmempty = false;
|
|
||||||
o.datatype = 'uinteger';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
o = s.taboption(tabname, form.Value, 'AUTOHOSTLIST_RETRANS_THRESHOLD', _('RETRANS_THRESHOLD'));
|
o = s.taboption(tabname, form.Value, 'AUTOHOSTLIST_RETRANS_THRESHOLD', _('RETRANS_THRESHOLD'));
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
textarea, .cbi-value textarea
|
|
||||||
{
|
|
||||||
white-space: pre;
|
|
||||||
overflow-x: auto;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
@@ -506,10 +506,24 @@ return baseclass.extend({
|
|||||||
value = value.replace(/˂/g, '<');
|
value = value.replace(/˂/g, '<');
|
||||||
value = value.replace(/˃/g, '>');
|
value = value.replace(/˃/g, '>');
|
||||||
try {
|
try {
|
||||||
let elem = document.getElementById("widget.cbid." + this.appName + ".config._" + this.cfgparam);
|
let elem = document.getElementById("cbi-" + this.appName + "-" + this.cfgsec + "-_" + this.cfgparam);
|
||||||
|
if (elem) {
|
||||||
|
if (elem.querySelector('div')) {
|
||||||
|
elem = elem.querySelector('div');
|
||||||
|
} else {
|
||||||
|
elem = elem.querySelector('output');
|
||||||
|
}
|
||||||
|
}
|
||||||
if (elem) {
|
if (elem) {
|
||||||
let val = value.trim();
|
let val = value.trim();
|
||||||
elem.textContent = val;
|
if (this.multiline) {
|
||||||
|
val = val.replace(/</g, '˂');
|
||||||
|
val = val.replace(/>/g, '˃');
|
||||||
|
val = val.replace(/\n/g, '<br/>');
|
||||||
|
elem.innerHTML = val;
|
||||||
|
} else {
|
||||||
|
elem.textContent = val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('ERROR: cannot found elem for ' + this.cfgsec + '.' + this.cfgparam);
|
console.error('ERROR: cannot found elem for ' + this.cfgsec + '.' + this.cfgparam);
|
||||||
|
|||||||
137
zapret/Makefile
137
zapret/Makefile
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=zapret
|
PKG_NAME:=zapret
|
||||||
PKG_VERSION:=72.20260114
|
PKG_VERSION:=72.20260111
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
PKG_MAINTAINER:=bol-van
|
||||||
@@ -14,8 +14,8 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=76764ad6b0ee7d3991c97e7b8c24d53189d25c28
|
PKG_SOURCE_VERSION:=a775aa7aaa4903a8c0870f9c16918e9d19d83772
|
||||||
PKG_SOURCE_DATE:=2026-01-14
|
PKG_SOURCE_DATE:=2026-01-11
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
||||||
@@ -57,17 +57,10 @@ define Build/Compile
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/conffiles
|
define Package/$(PKG_NAME)/conffiles
|
||||||
|
/etc/config/zapret
|
||||||
/opt/zapret/config
|
/opt/zapret/config
|
||||||
/opt/zapret/ipset/zapret-hosts-google.txt
|
/opt/zapret/ipset/
|
||||||
/opt/zapret/ipset/zapret-hosts-user.txt
|
/opt/zapret/init.d/openwrt/custom.d/
|
||||||
/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
|
||||||
/opt/zapret/ipset/zapret-ip-exclude.txt
|
|
||||||
/opt/zapret/ipset/zapret-hosts-auto.txt
|
|
||||||
/opt/zapret/init.d/openwrt/custom.d/10-script.sh
|
|
||||||
/opt/zapret/init.d/openwrt/custom.d/20-script.sh
|
|
||||||
/opt/zapret/init.d/openwrt/custom.d/50-script.sh
|
|
||||||
/opt/zapret/init.d/openwrt/custom.d/60-script.sh
|
|
||||||
/opt/zapret/init.d/openwrt/custom.d/90-script.sh
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
define Package/$(PKG_NAME)/install
|
||||||
@@ -97,7 +90,6 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./init.d.sh $(1)/etc/init.d/zapret
|
$(INSTALL_BIN) ./init.d.sh $(1)/etc/init.d/zapret
|
||||||
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config.default
|
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config.default
|
||||||
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config
|
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-google.txt $(1)/opt/zapret/ipset/zapret-hosts-google.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-google.txt $(1)/opt/zapret/ipset/zapret-hosts-google.txt
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret/ipset/zapret-hosts-user.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret/ipset/zapret-hosts-user.txt
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
||||||
@@ -113,96 +105,42 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(CP) ./custom.d/* $(1)/opt/zapret/init.d/openwrt/custom.d/
|
$(CP) ./custom.d/* $(1)/opt/zapret/init.d/openwrt/custom.d/
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret-uci-def-cfg.sh
|
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret-uci-def-cfg.sh
|
||||||
# install all sh-scripts
|
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/opt/zapret/uci-def-cfg.sh
|
||||||
$(CP) ./*.sh $(1)/opt/zapret/
|
$(INSTALL_BIN) ./comfunc.sh $(1)/opt/zapret/comfunc.sh
|
||||||
rm -f $(1)/opt/zapret/init.d.sh
|
$(INSTALL_BIN) ./def-cfg.sh $(1)/opt/zapret/def-cfg.sh
|
||||||
# Create empty conf files
|
$(INSTALL_BIN) ./renew-cfg.sh $(1)/opt/zapret/renew-cfg.sh
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/zapret-hosts-auto.txt
|
$(INSTALL_BIN) ./restore-def-cfg.sh $(1)/opt/zapret/restore-def-cfg.sh
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust1.txt
|
$(INSTALL_BIN) ./sync_config.sh $(1)/opt/zapret/sync_config.sh
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust2.txt
|
$(INSTALL_BIN) ./script-exec.sh $(1)/opt/zapret/script-exec.sh
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust3.txt
|
$(INSTALL_BIN) ./update-pkg.sh $(1)/opt/zapret/update-pkg.sh
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust4.txt
|
# Fix permisions
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/10-script.sh
|
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/20-script.sh
|
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/60-script.sh
|
|
||||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/90-script.sh
|
|
||||||
# Fix permissions
|
|
||||||
chmod 644 $(1)/opt/zapret/ipset/*.txt
|
chmod 644 $(1)/opt/zapret/ipset/*.txt
|
||||||
chmod 644 $(1)/opt/zapret/ipset_def/*.txt
|
chmod 644 $(1)/opt/zapret/ipset_def/*.txt
|
||||||
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
||||||
chmod 644 $(1)/opt/zapret/config*
|
chmod 644 $(1)/opt/zapret/config.default
|
||||||
chmod 755 $(1)/opt/zapret/*.sh
|
chmod 755 $(1)/opt/zapret/*.sh
|
||||||
chmod 755 $(1)/opt/zapret/$(MAKE_PATH)/*
|
chmod 755 $(1)/opt/zapret/$(MAKE_PATH)/*
|
||||||
chmod 755 $(1)/opt/zapret/ip2net/*
|
chmod 755 $(1)/opt/zapret/ip2net/*
|
||||||
chmod 755 $(1)/opt/zapret/mdig/*
|
chmod 755 $(1)/opt/zapret/mdig/*
|
||||||
# Disable TPWS in blockcheck
|
|
||||||
grep -q '^SKIP_TPWS=' $(1)/opt/zapret/blockcheck.sh || sed -i '/^NFT_TABLE=blockcheck$$$$/a SKIP_TPWS=$$$${SKIP_TPWS:-1}' $(1)/opt/zapret/blockcheck.sh
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/preinst
|
define Package/$(PKG_NAME)/preinst
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
ZAPRET_DIR=/opt/zapret
|
if [ -f "/etc/init.d/zapret" ]; then
|
||||||
ZAPRET_INITD=/etc/init.d/zapret
|
SCRIPT=$$( readlink /etc/init.d/zapret )
|
||||||
ZAPRET_CFG=/etc/config/zapret
|
|
||||||
if [ -f "$${ZAPRET_INITD}" ]; then
|
|
||||||
SCRIPT=$$( readlink "$${ZAPRET_INITD}" )
|
|
||||||
if [ -n "$${SCRIPT}" ]; then
|
if [ -n "$${SCRIPT}" ]; then
|
||||||
echo "Please uninstall incompatible \"zapret\" service!"
|
echo "Please uninstall original zapret utility!"
|
||||||
exit 44
|
exit 44
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if command -v apk >/dev/null; then
|
|
||||||
PKG_MGR="apk"
|
|
||||||
PKG_CHECK="apk info -e "
|
|
||||||
PKG_REMOVE="apk del --force "
|
|
||||||
else
|
|
||||||
PKG_MGR="opkg"
|
|
||||||
PKG_CHECK="opkg status "
|
|
||||||
PKG_REMOVE="opkg remove --force-remove "
|
|
||||||
fi
|
|
||||||
if [ "$${PKG_UPGRADE}" = "1" ]; then
|
if [ "$${PKG_UPGRADE}" = "1" ]; then
|
||||||
# stop service if PKG_UPGRADE
|
# stop service if PKG_UPGRADE
|
||||||
if [ -x "$${ZAPRET_INITD}" ]; then
|
if [ -x "/etc/init.d/zapret" ]; then
|
||||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
/etc/init.d/zapret running && /etc/init.d/zapret stop >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if $${PKG_CHECK} zapret >/dev/null 2>&1; then
|
|
||||||
if [ ! -f "/opt/zapret/sync_config.sh" ]; then
|
|
||||||
echo "Please uninstall incompatible \"zapret\" package!"
|
|
||||||
exit 47
|
|
||||||
fi
|
|
||||||
if [ -f "$${ZAPRET_CFG}" ] && ! grep -q "run_on_boot" "$${ZAPRET_CFG}"; then
|
|
||||||
echo "Please uninstall incompatible \"zapret\" package!"
|
|
||||||
exit 48
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if $${PKG_CHECK} luci-app-zapret >/dev/null 2>&1; then
|
|
||||||
SVC_FILE=/www/luci-static/resources/view/zapret/service.js
|
|
||||||
if [ ! -f "$${SVC_FILE}" ] || ! grep -Fq "/remittor/zapret-openwrt" "$${SVC_FILE}"; then
|
|
||||||
echo "Please uninstall incompatible \"luci-app-zapret\" package!"
|
|
||||||
exit 55
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f "$${ZAPRET_CFG}" ] && ! grep -q "run_on_boot" "$${ZAPRET_CFG}"; then
|
|
||||||
if [ -x "$${ZAPRET_INITD}" ]; then
|
|
||||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
rm -f $${ZAPRET_CFG}
|
|
||||||
rm -f $${ZAPRET_INITD}
|
|
||||||
[ -d "$${ZAPRET_DIR}" ] && rm -rf $${ZAPRET_DIR}
|
|
||||||
echo "All files of the previously installed package have been removed!"
|
|
||||||
fi
|
|
||||||
if $${PKG_CHECK} zapret-mdig >/dev/null 2>&1; then
|
|
||||||
$${PKG_REMOVE} zapret-mdig
|
|
||||||
fi
|
|
||||||
if $${PKG_CHECK} zapret-ip2net >/dev/null 2>&1; then
|
|
||||||
$${PKG_REMOVE} zapret-ip2net
|
|
||||||
fi
|
|
||||||
if [ ! -d "$${ZAPRET_DIR}" ]; then
|
|
||||||
mkdir -p $${ZAPRET_DIR}
|
|
||||||
fi
|
|
||||||
if [ ! -f "/opt/zapret/ipset/zapret-hosts-google.txt" ]; then
|
if [ ! -f "/opt/zapret/ipset/zapret-hosts-google.txt" ]; then
|
||||||
if [ -f "/opt/zapret/ipset/zapret-hosts-user.txt" ]; then
|
if [ -f "/opt/zapret/ipset/zapret-hosts-user.txt" ]; then
|
||||||
CFGLISTHASH=$$( md5sum "/opt/zapret/ipset/zapret-hosts-user.txt" | awk '{print $$1;}' )
|
CFGLISTHASH=$$( md5sum "/opt/zapret/ipset/zapret-hosts-user.txt" | awk '{print $$1;}' )
|
||||||
@@ -219,17 +157,8 @@ define Package/$(PKG_NAME)/postinst
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
ZAPRET_DIR=/opt/zapret
|
|
||||||
ZAPRET_INITD=/etc/init.d/zapret
|
|
||||||
ZAPRET_CFG=/etc/config/zapret
|
|
||||||
ZAPRET_CONFIG=/opt/zapret/config
|
ZAPRET_CONFIG=/opt/zapret/config
|
||||||
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
||||||
# Fix permissions
|
|
||||||
chmod 644 $${ZAPRET_CFG} >/dev/null 2>&1
|
|
||||||
chmod 644 $${ZAPRET_DIR}/ipset/*.txt >/dev/null 2>&1
|
|
||||||
chmod 644 $${ZAPRET_DIR}/ipset_def/*.txt >/dev/null 2>&1
|
|
||||||
chmod 644 $${ZAPRET_DIR}/init.d/openwrt/custom.d/*.sh >/dev/null 2>&1
|
|
||||||
chmod 644 $${ZAPRET_DIR}/config* >/dev/null 2>&1
|
|
||||||
# creating main config if its not exists
|
# creating main config if its not exists
|
||||||
if [ ! -f "$${ZAPRET_CONFIG}" ]; then
|
if [ ! -f "$${ZAPRET_CONFIG}" ]; then
|
||||||
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
@@ -242,10 +171,8 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
echo "Current file $${ZAPRET_CONFIG} backuped to $${ZAPRET_CONFIG_BACKUP}"
|
echo "Current file $${ZAPRET_CONFIG} backuped to $${ZAPRET_CONFIG_BACKUP}"
|
||||||
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
fi
|
fi
|
||||||
# remove fake uci-config
|
|
||||||
[ -f "$${ZAPRET_CFG}" ] && [ ! -s "$${ZAPRET_CFG}" ] && rm -f "$${ZAPRET_CFG}"
|
|
||||||
# check existing uci-config
|
# check existing uci-config
|
||||||
[ -f "$${ZAPRET_CFG}" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
[ -f "/etc/config/zapret" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
||||||
# create or merge uci-config
|
# create or merge uci-config
|
||||||
/opt/zapret/uci-def-cfg.sh
|
/opt/zapret/uci-def-cfg.sh
|
||||||
[ "$${ZAPRET_CFG_EXISTS}" = "1" ] && echo "Config /etc/config/zapret merged with default uci-config"
|
[ "$${ZAPRET_CFG_EXISTS}" = "1" ] && echo "Config /etc/config/zapret merged with default uci-config"
|
||||||
@@ -257,13 +184,13 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || exit 58
|
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || exit 58
|
||||||
# enable main service
|
# enable main service
|
||||||
$${ZAPRET_INITD} enable
|
/etc/init.d/zapret enable
|
||||||
# stop all
|
# stop all
|
||||||
$${ZAPRET_INITD} stop_fw >/dev/null 2>&1
|
/etc/init.d/zapret stop_fw
|
||||||
$${ZAPRET_INITD} stop_daemons >/dev/null 2>&1
|
/etc/init.d/zapret stop_daemons
|
||||||
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||||
# start main service
|
# start main service
|
||||||
$${ZAPRET_INITD} start
|
/etc/init.d/zapret start
|
||||||
# restart firewall
|
# restart firewall
|
||||||
[ -x /sbin/fw4 ] && fw4 -q restart || fw3 -q restart
|
[ -x /sbin/fw4 ] && fw4 -q restart || fw3 -q restart
|
||||||
fi
|
fi
|
||||||
@@ -274,10 +201,8 @@ define Package/$(PKG_NAME)/prerm
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
ZAPRET_DIR=/opt/zapret
|
EXEDIR=/opt/zapret
|
||||||
ZAPRET_BASE=/opt/zapret
|
ZAPRET_BASE=/opt/zapret
|
||||||
ZAPRET_INITD=/etc/init.d/zapret
|
|
||||||
ZAPRET_CFG=/etc/config/zapret
|
|
||||||
ZAPRET_CONFIG=/opt/zapret/config
|
ZAPRET_CONFIG=/opt/zapret/config
|
||||||
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
||||||
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
||||||
@@ -292,8 +217,8 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
. "$${ZAPRET_BASE}/common/fwtype.sh"
|
. "$${ZAPRET_BASE}/common/fwtype.sh"
|
||||||
. "$${ZAPRET_BASE}/common/nft.sh"
|
. "$${ZAPRET_BASE}/common/nft.sh"
|
||||||
. "$${ZAPRET_BASE}/common/installer.sh"
|
. "$${ZAPRET_BASE}/common/installer.sh"
|
||||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
/etc/init.d/zapret running && /etc/init.d/zapret stop
|
||||||
$${ZAPRET_INITD} disable >/dev/null 2>&1
|
/etc/init.d/zapret disable
|
||||||
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||||
remove_openwrt_firewall
|
remove_openwrt_firewall
|
||||||
nft_del_table
|
nft_del_table
|
||||||
@@ -306,9 +231,7 @@ define Package/$(PKG_NAME)/postrm
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
rm -f /etc/config/zapret-opkg*
|
[ -f "/etc/config/zapret-opkg" ] && rm -f "/etc/config/zapret-opkg"
|
||||||
rm -f /etc/config/zapret.opkg*
|
|
||||||
rm -f /etc/config/zapret.apk*
|
|
||||||
[ -f "/opt/zapret/config" ] && cp -f /opt/zapret/config "/opt/zapret/config.backup"
|
[ -f "/opt/zapret/config" ] && cp -f /opt/zapret/config "/opt/zapret/config.backup"
|
||||||
#rm -rf /opt/zapret
|
#rm -rf /opt/zapret
|
||||||
#echo "Directory /opt/zapret removed!"
|
#echo "Directory /opt/zapret removed!"
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ function restore_all_ipset_cfg
|
|||||||
restore_ipset_txt zapret-hosts-google.txt
|
restore_ipset_txt zapret-hosts-google.txt
|
||||||
restore_ipset_txt zapret-hosts-user.txt
|
restore_ipset_txt zapret-hosts-user.txt
|
||||||
restore_ipset_txt zapret-hosts-user-exclude.txt
|
restore_ipset_txt zapret-hosts-user-exclude.txt
|
||||||
restore_ipset_txt zapret-ip-exclude.txt
|
restore_ipset_txt zapret-ip-exclude.txt.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_default_cfg
|
function create_default_cfg
|
||||||
@@ -179,7 +179,7 @@ function insert_cron_task_logs
|
|||||||
{
|
{
|
||||||
[ ! -f "$CRONTAB_FILE" ] && touch "$CRONTAB_FILE"
|
[ ! -f "$CRONTAB_FILE" ] && touch "$CRONTAB_FILE"
|
||||||
[ ! -f "$CRONTAB_FILE" ] && return 1
|
[ ! -f "$CRONTAB_FILE" ] && return 1
|
||||||
if ! grep -q -e "-name '$ZAPRET_CFG_NAME+\*\.log' -size \+" "$CRONTAB_FILE"; then
|
if ! grep -q -e "-name '$ZAPRET_CFG_NAME\*\.log' -size \+" "$CRONTAB_FILE"; then
|
||||||
echo "*/2 * * * * /usr/bin/find /tmp -maxdepth 1 -type f -name '$ZAPRET_CFG_NAME+*.log' -size +2600k -exec rm -f {} \;" >> "$CRONTAB_FILE"
|
echo "*/2 * * * * /usr/bin/find /tmp -maxdepth 1 -type f -name '$ZAPRET_CFG_NAME+*.log' -size +2600k -exec rm -f {} \;" >> "$CRONTAB_FILE"
|
||||||
/etc/init.d/cron restart 2> /dev/null
|
/etc/init.d/cron restart 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
function set_cfg_reset_values
|
function set_cfg_reset_values
|
||||||
{
|
{
|
||||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( printf '\t' )"
|
local TAB="$( echo -n -e '\t' )"
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.run_on_boot='0'
|
set $cfgname.config.run_on_boot='0'
|
||||||
# settings for zapret service
|
# settings for zapret service
|
||||||
@@ -47,7 +47,7 @@ function set_cfg_reset_values
|
|||||||
function clear_nfqws_strat
|
function clear_nfqws_strat
|
||||||
{
|
{
|
||||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( printf '\t' )"
|
local TAB="$( echo -n -e '\t' )"
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.MODE_FILTER='hostlist'
|
set $cfgname.config.MODE_FILTER='hostlist'
|
||||||
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
||||||
@@ -61,7 +61,7 @@ function set_cfg_nfqws_strat
|
|||||||
{
|
{
|
||||||
local strat=${1:--}
|
local strat=${1:--}
|
||||||
local cfgname=${2:-$ZAPRET_CFG_NAME}
|
local cfgname=${2:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( printf '\t' )"
|
local TAB="$( echo -n -e '\t' )"
|
||||||
|
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.MODE_FILTER='hostlist'
|
set $cfgname.config.MODE_FILTER='hostlist'
|
||||||
|
|||||||
123
zapret/dwc.sh
123
zapret/dwc.sh
@@ -9,9 +9,6 @@ rm -rf $ZAP_TMP_DIR
|
|||||||
|
|
||||||
CURL_TIMEOUT=5
|
CURL_TIMEOUT=5
|
||||||
CURL_RANGETO=65535
|
CURL_RANGETO=65535
|
||||||
CURL_NOCACHE='cache-control: no-cache'
|
|
||||||
CURL_NOCACHE2='pragma: no-cache'
|
|
||||||
CURL_USERAGENT='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'
|
|
||||||
|
|
||||||
if ! command -v curl >/dev/null 2>&1; then
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
echo "ERROR: package \"curl\" not installed!"
|
echo "ERROR: package \"curl\" not installed!"
|
||||||
@@ -48,7 +45,7 @@ TEST_SUITE='[
|
|||||||
{ id: "DE.AWS-01", provider: "🇩🇪 AWS", times: 1, url: "https://www.getscope.com/assets/fonts/fa-solid-900.woff2" },
|
{ id: "DE.AWS-01", provider: "🇩🇪 AWS", times: 1, url: "https://www.getscope.com/assets/fonts/fa-solid-900.woff2" },
|
||||||
{ id: "US.AWS-01", provider: "🇺🇸 AWS", times: 1, url: "https://corp.kaltura.com/wp-content/cache/min/1/wp-content/themes/airfleet/dist/styles/theme.css" },
|
{ id: "US.AWS-01", provider: "🇺🇸 AWS", times: 1, url: "https://corp.kaltura.com/wp-content/cache/min/1/wp-content/themes/airfleet/dist/styles/theme.css" },
|
||||||
{ id: "US.GC-01", provider: "🇺🇸 Google Cloud", times: 1, url: "https://api.usercentrics.eu/gvl/v3/en.json" },
|
{ id: "US.GC-01", provider: "🇺🇸 Google Cloud", times: 1, url: "https://api.usercentrics.eu/gvl/v3/en.json" },
|
||||||
{ id: "US.FST-01", provider: "🇺🇸 Fastly", times: 1, url: "https://www.jetblue.com/footer/footer-element-es2015.js" },
|
{ id: "US.FST-01", provider: "🇺🇸 Fastly", times: 1, url: "https://www.jetblue.com/main.c7b61d59416f714f.js" },
|
||||||
{ id: "CA.FST-01", provider: "🇨🇦 Fastly", times: 1, url: "https://www.cnn10.com/" },
|
{ id: "CA.FST-01", provider: "🇨🇦 Fastly", times: 1, url: "https://www.cnn10.com/" },
|
||||||
{ id: "US.AKM-01", provider: "🇺🇸 Akamai", times: 1, url: "https://www.roxio.com/static/roxio/images/products/creator/nxt9/call-action-footer-bg.jpg" },
|
{ id: "US.AKM-01", provider: "🇺🇸 Akamai", times: 1, url: "https://www.roxio.com/static/roxio/images/products/creator/nxt9/call-action-footer-bg.jpg" },
|
||||||
{ id: "PL.AKM-01", provider: "🇵🇱 Akamai", times: 1, url: "https://media-assets.stryker.com/is/image/stryker/gateway_1?$max_width_1410$" },
|
{ id: "PL.AKM-01", provider: "🇵🇱 Akamai", times: 1, url: "https://media-assets.stryker.com/is/image/stryker/gateway_1?$max_width_1410$" },
|
||||||
@@ -63,107 +60,59 @@ function trim
|
|||||||
echo "$1" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
|
echo "$1" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p "$ZAP_TMP_DIR"
|
mkdir -p $ZAP_TMP_DIR
|
||||||
|
|
||||||
TARGET_LIST_FILE="$ZAP_TMP_DIR/targets"
|
ID=0
|
||||||
: > "$TARGET_LIST_FILE"
|
while IFS='|' read -r TAG PROVIDER TIMES URL; do
|
||||||
IDX=0
|
|
||||||
while IFS= read -r line; do
|
|
||||||
case "$line" in
|
|
||||||
*id:*provider:*url:*)
|
|
||||||
IDX=$((IDX + 1))
|
|
||||||
TAG=$( printf '%s\n' "$line" | cut -d'"' -f2 )
|
|
||||||
COUNTRY="${TAG%%.*}"
|
|
||||||
PROVIDER_RAW=$( printf '%s\n' "$line" | cut -d'"' -f4 )
|
|
||||||
PROVIDER="${PROVIDER_RAW#* }"
|
|
||||||
TIMES=$( printf '%s\n' "$line" | cut -d':' -f4 | cut -d',' -f1 | tr -d ' ')
|
|
||||||
URL=$( printf '%s\n' "$line" | cut -d'"' -f6 )
|
|
||||||
echo "${IDX}|${TAG}|${COUNTRY}|${PROVIDER}|${TIMES}|${URL}" >> "$TARGET_LIST_FILE"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<EOF
|
|
||||||
$TEST_SUITE
|
|
||||||
EOF
|
|
||||||
|
|
||||||
CURL_CON_TIMEOUT=$((CURL_TIMEOUT-2))
|
|
||||||
CURL_SPEED_TIME=$((CURL_TIMEOUT-2))
|
|
||||||
CURL_SPEED_LIMIT=1
|
|
||||||
|
|
||||||
while IFS='|' read -r ID TAG COUNTRY PROVIDER TIMES URL; do
|
|
||||||
[ -z "$TAG" ] && continue
|
[ -z "$TAG" ] && continue
|
||||||
ID=$((ID+1))
|
ID=$((ID+1))
|
||||||
ID3=$( printf '%03d' "$ID" )
|
ID3=$(printf '%03d' "$ID")
|
||||||
COUNTRY=$( echo "$TAG" | cut -d. -f1 )
|
COUNTRY="$(echo "$TAG" | cut -d. -f1)"
|
||||||
CNTFLAG=$( echo "$PROVIDER" | awk '{print $1}' )
|
CNTFLAG="$(echo "$PROVIDER" | awk '{print $1}')"
|
||||||
|
PROVIDER="$(echo "$PROVIDER" | cut -d' ' -f2-)"
|
||||||
URL_NO_PROTO="${URL#*://}"
|
URL_NO_PROTO="${URL#*://}"
|
||||||
DOMAIN="${URL_NO_PROTO%%/*}"
|
DOMAIN="${URL_NO_PROTO%%/*}"
|
||||||
URLPATH="/${URL_NO_PROTO#*/}"
|
URLPATH="/${URL_NO_PROTO#*/}"
|
||||||
[ "$URLPATH" = "/$URL_NO_PROTO" ] && URLPATH="/"
|
[ "$URLPATH" = "/$URL_NO_PROTO" ] && URLPATH="/"
|
||||||
#echo "TAG=$TAG , COUNTRY=$COUNTRY , PROVIDER=$PROVIDER , DOMAIN=$DOMAIN , URL=$URL"
|
#echo "TAG=$TAG , COUNTRY=$COUNTRY , PROVIDER=$PROVIDER , TIMES=$TIMES , URL=$URL"
|
||||||
FNAME="$ZAP_TMP_DIR/$ID3=$TAG=$PROVIDER"
|
|
||||||
(
|
(
|
||||||
DST_IP="???"
|
DST_IP=$( curl -4 -s -o /dev/null -w '%{remote_ip}\n' $DOMAIN )
|
||||||
if [ "$DST_IP" = "" ]; then
|
if [ -z "$DST_IP" ]; then
|
||||||
CURL_TIMEOUTS="--connect-timeout 5 --max-time 6 --speed-time 5 --speed-limit 1"
|
DST_IP="$( ping -c1 "$DOMAIN" 2>/dev/null | sed -n '1s/.*(\([0-9.]*\)).*/\1/p')"
|
||||||
#DST_IP=$( curl -4 -I -s $CURL_TIMEOUTS -o /dev/null -w '%{remote_ip}\n' "$URL" )
|
|
||||||
if [ -z "$DST_IP" ]; then
|
|
||||||
DST_IP=$( curl -4 -s $CURL_TIMEOUTS -o /dev/null -r 0-0 -w '%{remote_ip}\n' "$URL" )
|
|
||||||
fi
|
|
||||||
if [ -z "$DST_IP" ]; then
|
|
||||||
DST_IP="$( ping -c1 "$DOMAIN" 2>/dev/null | sed -n '1s/.*(\([0-9.]*\)).*/\1/p')"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
echo "$URL" > "$FNAME.url"
|
curl -k $URL --resolve $DOMAIN:443:$DST_IP -o /dev/null -s -w '%{size_download}\n' --max-time $CURL_TIMEOUT --range 0-$CURL_RANGETO
|
||||||
echo "$DST_IP" > "$FNAME.ip"
|
) >"$ZAP_TMP_DIR/$ID3.$TAG.txt" 2>&1 &
|
||||||
RESOLVE_OPT="--resolve $DOMAIN:443:$DST_IP"
|
done <<EOF
|
||||||
curl "$URL" \
|
$(printf '%s\n' "$TEST_SUITE" | sed -n '
|
||||||
--connect-timeout $CURL_CON_TIMEOUT \
|
s/.*id:[[:space:]]*"\([^"]*\)".*provider:[[:space:]]*"\([^"]*\)".*times:[[:space:]]*\([0-9]\+\).*url:[[:space:]]*"\([^"]*\)".*/\1|\2|\3|\4/p
|
||||||
--max-time $CURL_TIMEOUT \
|
')
|
||||||
--speed-time $CURL_SPEED_TIME \
|
EOF
|
||||||
--speed-limit $CURL_SPEED_LIMIT \
|
|
||||||
--range 0-$CURL_RANGETO \
|
|
||||||
-A "$CURL_USERAGENT" \
|
|
||||||
-D "$FNAME.hdr" \
|
|
||||||
-o "$FNAME.body"
|
|
||||||
) > "$FNAME.txt" 2>&1 &
|
|
||||||
done < "$TARGET_LIST_FILE"
|
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
printf '%s\n' "$ZAP_TMP_DIR"/*.txt | sort | while IFS= read -r file; do
|
for file in $(ls "$ZAP_TMP_DIR"/*.txt | sort); do
|
||||||
[ -f "$file" ] || continue
|
[ -f "$file" ] || continue
|
||||||
FNAME="${file##*/}"
|
tag="${file##*/}"
|
||||||
FNAME="${FNAME%.txt}"
|
tag="${tag%.txt}"
|
||||||
ID=$( echo "$FNAME" | cut -d= -f1)
|
tag="${tag#*.}"
|
||||||
TAG=$( echo "$FNAME" | cut -d= -f2)
|
res=$( cat "$file" )
|
||||||
PROVIDER=$(echo "$FNAME" | cut -d= -f3 )
|
res=$( trim "$res" )
|
||||||
FNAME="$ZAP_TMP_DIR/$FNAME"
|
|
||||||
BODY_SIZE=0
|
|
||||||
[ -f "$FNAME.body" ] && BODY_SIZE=$( wc -c < "$FNAME.body" )
|
|
||||||
status=
|
status=
|
||||||
if [ ! -f "$FNAME.ip" ]; then
|
case "$res" in
|
||||||
status="ERROR: cannot get IP-Addr"
|
''|*[!0-9]*)
|
||||||
elif [ ! -s "$FNAME.ip" ]; then
|
status="Error (incorrect value)"
|
||||||
status="ERROR: cannot get ip-addr"
|
;;
|
||||||
elif [ ! -f "$FNAME.hdr" ]; then
|
esac
|
||||||
status="ERROR: cannot Get Headers"
|
if [ -z "$status" ]; then
|
||||||
elif [ ! -s "$FNAME.hdr" ]; then
|
if [ "$res" = 0 ]; then
|
||||||
status="ERROR: cannot get headers"
|
status="Possibly detected"
|
||||||
elif [ ! -f "$FNAME.body" ]; then
|
elif [ "$res" -lt $CURL_RANGETO ]; then
|
||||||
status="ERROR: cannot get body"
|
status="Failed to complete detection"
|
||||||
elif [ ! -s "$FNAME.body" ]; then
|
|
||||||
status="Possibly detected"
|
|
||||||
else
|
|
||||||
if [ "$BODY_SIZE" -le $CURL_RANGETO ]; then
|
|
||||||
status="Failed to complete detection (recv $BODY_SIZE bytes)"
|
|
||||||
else
|
else
|
||||||
status="[ OK ]"
|
status="[ OK ]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
printf '%12s / %-13s: %s \n' "$TAG" "$PROVIDER" "$status"
|
printf '%12s: %s \n' "$tag" "$status"
|
||||||
echo "$BODY_SIZE" > "$FNAME.size"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$ZAP_TMP_DIR"/*.body >/dev/null 2>&1
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ gosuslugi.ru
|
|||||||
mos-gorsud.ru
|
mos-gorsud.ru
|
||||||
gov.ru
|
gov.ru
|
||||||
sudrf.ru
|
sudrf.ru
|
||||||
ottai.com
|
|
||||||
ipstream.one
|
ipstream.one
|
||||||
#################################### Epicgames
|
#################################### Epicgames
|
||||||
easy.ac
|
easy.ac
|
||||||
@@ -254,109 +253,4 @@ vod-secure.twitch.tv
|
|||||||
irc-ws.chat.twitch.tv
|
irc-ws.chat.twitch.tv
|
||||||
pubsub-edge.twitch.tv
|
pubsub-edge.twitch.tv
|
||||||
vod-pop-secure.twitch.tv
|
vod-pop-secure.twitch.tv
|
||||||
#################################### Valorant
|
|
||||||
pvp.net
|
|
||||||
vivox.com
|
|
||||||
sd-rtn.com
|
|
||||||
riotcdn.net
|
|
||||||
adobess.com
|
|
||||||
valorant.com
|
|
||||||
akamaihd.net
|
|
||||||
riotgames.com
|
|
||||||
playvalorant.com
|
|
||||||
#################################### TikTok
|
|
||||||
musical.ly
|
|
||||||
tiktok.com
|
|
||||||
tiktokv.eu
|
|
||||||
tiktokv.us
|
|
||||||
tiktokw.eu
|
|
||||||
tiktokw.us
|
|
||||||
muscdn.com
|
|
||||||
tiktokd.net
|
|
||||||
tiktokd.org
|
|
||||||
tiktokv.com
|
|
||||||
tiktokcdn.com
|
|
||||||
ibytedtos.com
|
|
||||||
ttwstatic.com
|
|
||||||
tik-tokapi.com
|
|
||||||
tiktok-row.net
|
|
||||||
tiktokminis.us
|
|
||||||
byteoversea.com
|
|
||||||
tiktok-minis.com
|
|
||||||
tiktokcdn-eu.com
|
|
||||||
tiktokcdn-us.com
|
|
||||||
tiktokeu-cdn.com
|
|
||||||
tiktokrow-cdn.com
|
|
||||||
tiktokglobalshopv.com
|
|
||||||
tiktokcdn.com.akamaized.net
|
|
||||||
tiktokcdn.com.edgesuite.net
|
|
||||||
tiktokcdn-us.com.edgesuite.net
|
|
||||||
#################################### Hoyoverse
|
|
||||||
hoyo.link
|
|
||||||
hoyolab.com
|
|
||||||
yuanshen.com
|
|
||||||
hoyoverse.com
|
|
||||||
genshinimpact.com
|
|
||||||
zenlesszonezero.com
|
|
||||||
#################################### Xiaomi
|
|
||||||
mi.com
|
|
||||||
miui.com
|
|
||||||
wali.com
|
|
||||||
c.mi.com
|
|
||||||
mgslb.com
|
|
||||||
mifile.cn
|
|
||||||
xiaomi.cn
|
|
||||||
mipay.com
|
|
||||||
youpin.cn
|
|
||||||
zmifi.com
|
|
||||||
mi-idc.com
|
|
||||||
mi-img.com
|
|
||||||
mijia.tech
|
|
||||||
mitvos.com
|
|
||||||
miwifi.com
|
|
||||||
xiaomi.com
|
|
||||||
xiaomi.net
|
|
||||||
duokan.com
|
|
||||||
saxyit.com
|
|
||||||
mi-fan.com
|
|
||||||
mihome.com
|
|
||||||
xiaomisa.cn
|
|
||||||
migames.com
|
|
||||||
miaibox.com
|
|
||||||
mi-home.com
|
|
||||||
xiaomicp.com
|
|
||||||
xiaomidns.cn
|
|
||||||
xiaomiev.com
|
|
||||||
xiaomiinc.cn
|
|
||||||
xiaominr.com
|
|
||||||
xiaomisa.com
|
|
||||||
xiaomisa.net
|
|
||||||
xiaomisa.org
|
|
||||||
roborock.com
|
|
||||||
mi-robot.com
|
|
||||||
yeelight.com
|
|
||||||
miot-spec.cn
|
|
||||||
xiaomidns.com
|
|
||||||
xiaomidns.net
|
|
||||||
xiaomiinc.com
|
|
||||||
xiaomiinc.net
|
|
||||||
duokanbox.com
|
|
||||||
youpin.com.cn
|
|
||||||
miot-spec.org
|
|
||||||
miot-spec.com
|
|
||||||
xiaomiwear.com
|
|
||||||
xiaomimimo.com
|
|
||||||
dreamehome.com
|
|
||||||
xiaomiprint.com
|
|
||||||
xiaomidns.com.cn
|
|
||||||
xiaomiinc.com.cn
|
|
||||||
xiaomimobile.com
|
|
||||||
xiaomixiaoai.com
|
|
||||||
xiaomiyoupin.com
|
|
||||||
xiaoaiassist.com
|
|
||||||
xiaomi-mijia.com
|
|
||||||
xiaomifactory.com
|
|
||||||
airstarfinance.net
|
|
||||||
dreame-technology.cn
|
|
||||||
dreame-technology.com
|
|
||||||
####################################
|
####################################
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function sync_param
|
|||||||
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
||||||
uncomment_param $param
|
uncomment_param $param
|
||||||
append_param $param
|
append_param $param
|
||||||
local TAB="$( printf '\t' )"
|
local TAB="$( echo -n -e '\t' )"
|
||||||
if [ "$value" = "$TAB" ]; then
|
if [ "$value" = "$TAB" ]; then
|
||||||
value=""
|
value=""
|
||||||
fi
|
fi
|
||||||
@@ -101,7 +101,6 @@ sync_param AUTOHOSTLIST_FAIL_TIME
|
|||||||
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
||||||
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
||||||
sync_param AUTOHOSTLIST_RETRANS_RESET
|
|
||||||
sync_param AUTOHOSTLIST_UDP_IN
|
sync_param AUTOHOSTLIST_UDP_IN
|
||||||
sync_param AUTOHOSTLIST_UDP_OUT
|
sync_param AUTOHOSTLIST_UDP_OUT
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2024 remittor
|
# Copyright (c) 2024 remittor
|
||||||
|
|
||||||
[ ! -f /opt/zapret/comfunc.sh ] && exit 0
|
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
. /opt/zapret/comfunc.sh
|
||||||
|
|
||||||
mkdir -p $ZAPRET_BASE/ipset
|
|
||||||
|
|
||||||
# create empty txt files into ipset directory
|
# create empty txt files into ipset directory
|
||||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-google.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-google.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-google.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-google.txt"
|
||||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt"
|
#[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt"
|
||||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user.txt"
|
||||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt"
|
||||||
#[ ! -f "$ZAPRET_BASE/ipset/zapret-ip.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip.txt"
|
#[ ! -f "$ZAPRET_BASE/ipset/zapret-ip.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip.txt"
|
||||||
@@ -18,6 +14,5 @@ mkdir -p $ZAPRET_BASE/ipset
|
|||||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt"
|
||||||
|
|
||||||
# create or merge uci-config
|
# create or merge uci-config
|
||||||
[ ! -f "$ZAPRET_BASE/renew-cfg.sh" ] && exit 0
|
|
||||||
$ZAPRET_BASE/renew-cfg.sh
|
$ZAPRET_BASE/renew-cfg.sh
|
||||||
|
|
||||||
Reference in New Issue
Block a user