forked from jperon/lunatik_snihook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.moon
39 lines (26 loc) · 835 Bytes
/
main.moon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- SPDX-FileCopyrightText: (c) 2024 jperon <cataclop@hotmail.com>
-- SPDX-License-Identifier: MIT OR GPL-2.0-only
-- Filter TLS packets based on SNI
-- Assuming that MoonScript files are transpiled into in /lib/modules/lua/snihook/*.lua,
--
-- > sudo lunatik spawn snihook/main
-- To disable it:
--
-- > sudo lunatik stop snihook/main
-- Once enabled, to add entries to whitelist:
-- > echo "+ DOMAIN" > /dev/sni_whitelist
-- To remove entries:
-- > echo "- DOMAIN" > /dev/sni_whitelist
rcu = require"rcu"
:run = rcu and require"lunatik.runner"
:shouldstop = require"thread"
:schedule = require"linux"
->
whitelist = rcu.table!
runtimes = {
run "snihook/dev", true
run "snihook/hook", false
}
rt\resume whitelist for rt in *runtimes
while not shouldstop! do schedule 1000
rt\stop! for rt in *runtimes