From c7397a469492bbf1eadb974e3171425019c3019f Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Sat, 12 Oct 2024 18:05:01 +0300 Subject: [PATCH] Add new flags from #132 to configuration interfaces --- .../luasrc/model/cbi/youtubeUnblock.lua | 17 +++++++++++++++++ youtubeUnblock/Makefile | 6 ++++++ youtubeUnblock/files/etc/init.d/youtubeUnblock | 2 +- .../files/etc/uci-defaults/99-youtubeUnblock.sh | 8 +++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua b/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua index 014b6cf..691ffcc 100644 --- a/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua +++ b/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua @@ -34,6 +34,16 @@ o:depends("faking_strategy", "randseq") o = s:option(Value, "fake_sni_seq_len", "fake sni seq len", "This flag specifies youtubeUnblock to build a complicated construction of fake client hello packets. length determines how much fakes will be sent.") o:depends("fake_sni", 1) +o = s:option(ListValue, "fake_sni_type", "fake sni type", "This flag specifies which faking message type should be used for fake packets. For random, the message of the random length and with random payload will be sent. For default the default payload (sni=www.google.com) is used. And for the custom option, the payload from --fake-custom-payload section utilized. Defaults to default.") +o:value("default", "default") +o:value("custom", "custom") +o:value("random", "random") +o.widget="radio" +o:depends("fake_sni", 1) + +o = s:option(Value, "fake_custom_payload", "fake custom payload", "Useful with --fake-sni-type=custom. You should specify the payload for fake message manually. Use hex format: --fake-custom-payload=0001020304 mean that 5 bytes sequence: 0x00, 0x01, 0x02, 0x03, 0x04 used as fake.") +o:depends("fake_sni_type", "custom") + o = s:option(ListValue, "frag", "fragmentation strategy", "Specifies the fragmentation strategy for the packet. Tcp is used by default. Ip fragmentation may be blocked by DPI system. None specifies no fragmentation. Probably this won't work, but may be will work for some fake sni strategies.") o:value("tcp", "tcp") o:value("ip", "ip") @@ -145,6 +155,13 @@ function fwo.write(self, section) sys.call("/etc/init.d/firewall reload") end +local rso = bs:option(Button, "_reset_settings", "Reset settins to defaults") +rso.inputtitle = "Reset" +rso.inputstyle = "negative" +function rso.write(self, section) + sys.call("/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh --force") +end + local logs = sys.exec("logread -l 800 -p youtubeUnblock | grep youtubeUnblock | sed '1!G;h;$!d'") local o = bs:option(DummyValue, "_logs", "Logs") o.rawhtml = true diff --git a/youtubeUnblock/Makefile b/youtubeUnblock/Makefile index 7d3c2c4..26d20bc 100644 --- a/youtubeUnblock/Makefile +++ b/youtubeUnblock/Makefile @@ -50,6 +50,12 @@ define Package/youtubeUnblock/install $(INSTALL_BIN) ./files/etc/uci-defaults/99-youtubeUnblock.sh $(1)/etc/uci-defaults/99-youtubeUnblock.sh $(INSTALL_DIR) $(1)/usr/share/nftables.d/ruleset-post/ $(INSTALL_DATA) ./files/nftables.d/537-youtubeUnblock.nft $(1)/usr/share/nftables.d/ruleset-post/537-youtubeUnblock.nft + $(INSTALL_DIR) $(1)/usr/share/youtubeUnblock/ + $(INSTALL_BIN) ./files/etc/uci-defaults/99-youtubeUnblock.sh $(1)/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh +endef + +define Package/youtubeUnblock/postinst +/etc/init.d/firewall reload endef $(eval $(call BuildPackage,youtubeUnblock)) diff --git a/youtubeUnblock/files/etc/init.d/youtubeUnblock b/youtubeUnblock/files/etc/init.d/youtubeUnblock index a4bcb15..f089a65 100755 --- a/youtubeUnblock/files/etc/init.d/youtubeUnblock +++ b/youtubeUnblock/files/etc/init.d/youtubeUnblock @@ -71,7 +71,7 @@ parse_options() { append_commasep_list "$config" sni_domains fi - append_opts "$config" queue_num fake_sni_seq_len faking_strategy faking_ttl fake_seq_offset frag frag_sni_pos fk_winsize synfake_len seg2delay packet_mark + append_opts "$config" queue_num fake_sni_seq_len faking_strategy faking_ttl fake_seq_offset frag frag_sni_pos fk_winsize synfake_len seg2delay packet_mark fake_sni_type fake_custom_payload append_commasep_list "$config" exclude_domains append_opts_boolean "$config" fake_sni frag_sni_reverse frag_sni_faked frag_middle_sni synfake append_opts_btoggler "$config" quic_drop silent trace no_gso no_ipv6 diff --git a/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh b/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh index ca99412..d9d9fe7 100644 --- a/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh +++ b/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh @@ -1,5 +1,7 @@ #!/bin/sh -[[ ! "$(uci -q get youtubeUnblock.youtubeUnblock)" == "" ]] && exit 0 +[[ ! "$(uci -q get youtubeUnblock.youtubeUnblock)" == "" ]] && [[ ! "$1" == "--force" ]] && exit 0 +[[ ! "$(uci -q get youtubeUnblock.youtubeUnblock)" == "" ]] && uci delete youtubeUnblock.youtubeUnblock + touch /etc/config/youtubeUnblock uci batch << EOI set youtubeUnblock.youtubeUnblock='youtubeUnblock' @@ -13,6 +15,8 @@ set youtubeUnblock.youtubeUnblock.packet_mark='32768' set youtubeUnblock.youtubeUnblock.fake_sni='1' set youtubeUnblock.youtubeUnblock.faking_strategy='pastseq' set youtubeUnblock.youtubeUnblock.fake_sni_seq_len='1' +set youtubeUnblock.youtubeUnblock.fake_sni_type='default' +set youtubeUnblock.youtubeUnblock.fake_custom_payload='' add_list youtubeUnblock.youtubeUnblock.sni_domains='googlevideo.com' add_list youtubeUnblock.youtubeUnblock.sni_domains='ggpht.com' add_list youtubeUnblock.youtubeUnblock.sni_domains='ytimg.com' @@ -25,5 +29,3 @@ add_list youtubeUnblock.youtubeUnblock.sni_domains='gstatic.com' add_list youtubeUnblock.youtubeUnblock.sni_domains='l.google.com' EOI uci commit -/etc/init.d/firewall restart &>/dev/null -exit 0