Skip to content

Commit

Permalink
Add new flags from #132 to configuration interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Waujito committed Oct 12, 2024
1 parent 1bf4f38 commit c7397a4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
17 changes: 17 additions & 0 deletions luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>default</code>.")
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")
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions youtubeUnblock/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion youtubeUnblock/files/etc/init.d/youtubeUnblock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand All @@ -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

0 comments on commit c7397a4

Please sign in to comment.