From fe8b8df2aebdad1cd7a5531006ae46f445e672f1 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 7 Jun 2026 08:34:40 +0300 Subject: [PATCH] nfqws2,zapret-lib: fix wrong spelling : WRITEABLE -> WRITABLE --- docs/changes.txt | 5 +++-- docs/manual.en.md | 12 ++++++------ docs/manual.md | 16 ++++++++-------- lua/zapret-lib.lua | 6 +++--- lua/zapret-pcap.lua | 6 +++--- nfq2/darkmagic.c | 8 ++++---- nfq2/darkmagic.h | 2 +- nfq2/nfqws.c | 22 +++++++++++----------- nfq2/nfqws.h | 2 +- nfq2/params.h | 4 ++-- 10 files changed, 42 insertions(+), 41 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 168c1fb..2bce9e7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -293,7 +293,8 @@ v0.9.4.3 * nfqws2: rewrite time counting algorithm, remove --timer-res -0.9.5.3 +1.0 * zapret-lib,zapret-antidpi: delay parameter in "send" desync function -* zapret-lib: fix oob urp=b case in rawsend_dissect_segmented +* zapret-lib: fix oob urp=0 case in rawsend_dissect_segmented +* nfqws2, zapret-lib: (LUA_COMPAT_VER=6) fix wrong spelling : WRITEABLE -> WRITABLE diff --git a/docs/manual.en.md b/docs/manual.en.md index c663e34..ed6a2b8 100644 --- a/docs/manual.en.md +++ b/docs/manual.en.md @@ -656,7 +656,7 @@ General parameters for all versions - nfqws2, dvtws2, winws2. --reasm-disable=[type[,type]] ; disable fragment reassembly for a list of payloads: tls_client_hello quic_initial. without arguments - disable reasm for everything. DESYNC ENGINE INIT: - --writeable[=] ; create a directory for Lua with write permissions and store its path in the "WRITEABLE" env variable (only one directory) + --writable[=] ; create a directory for Lua with write permissions and store its path in the "WRITABLE" env variable (only one directory) --blob=:[+ofs]@|0xHEX ; load a binary file or hex string into the Lua variable . +ofs specifies the offset from the start of the file --lua-init=@| ; execute Lua code from a string or file once at startup. supports gzipped files. automatically checks for ".gz" --lua-gc= ; Lua garbage collector invocation interval in seconds. 0 disables periodic calls. @@ -1018,7 +1018,7 @@ Windows: - All `Se*` privileges are irrevocably removed from the token, except for `SeChangeNotifyPrivilege`. - A Job object is used to prohibit the creation of child processes and restrict desktop interaction - clipboard access, changing desktop settings, changing display settings, etc. -There is a simple way to pass a writable directory to the Lua code using the `--writeable[=]` parameter. `nfqws2` creates the directory and assigns permissions so that the Lua code can write files there, then passes the directory name in the `WRITEABLE` environment variable. If `dirname` is not specified, a directory is created within `%USERPROFILE%/AppData/LocalLow` on Windows. +There is a simple way to pass a writable directory to the Lua code using the `--writable[=]` parameter. `nfqws2` creates the directory and assigns permissions so that the Lua code can write files there, then passes the directory name in the `WRITABLE` environment variable. If `dirname` is not specified, a directory is created within `%USERPROFILE%/AppData/LocalLow` on Windows. On the Lua side, dangerous functions are removed: `os.execute`, `io.popen`, `package.loadlib`, and the `debug` module. On GitHub, `nfqws2` executables are built with a version of LuaJIT that excludes FFI. @@ -1697,8 +1697,8 @@ Before executing `--lua-init`, the C code sets up base constants, blobs, and C f | env | Purpose | | :-------- |:---------- | -| WRITEABLE | A directory writable by Lua. Corresponds to the `--writeable` option. | -| APPDATALOW | (Windows only) The AppData location for the low mandatory level. This is also writable, but using `--writeable` is preferred for cross-platform compatibility. | +| WRITABLE | A directory writable by Lua. Corresponds to the `--writable` option. | +| APPDATALOW | (Windows only) The AppData location for the low mandatory level. This is also writable, but using `--writable` is preferred for cross-platform compatibility. | ## C functions @@ -3295,12 +3295,12 @@ function host_or_ip(desync) ``` function is_absolute_path(path) function append_path(path, file) -function writeable_file_name(filename) +function writeble_file_name(filename) ``` - `is_absolute_path` returns true if the path starts from the root. It accounts for CYGWIN path specifics. - `append_path` appends a file or directory name `file` to `path`, using '/' as a separator. -- `writeable_file_name` returns `filename` if it contains an absolute path or if the `WRITEABLE` environment variable is not set. Otherwise, it retrieves the path from the `WRITEABLE` environment variable and appends the `filename` using `append_path`. +- `writeble_file_name` returns `filename` if it contains an absolute path or if the `WRITABLE` environment variable is not set. Otherwise, it retrieves the path from the `WRITABLE` environment variable and appends the `filename` using `append_path`. ## Reading and writing Files diff --git a/docs/manual.md b/docs/manual.md index 0054e41..acadddf 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -715,7 +715,7 @@ nfqws2 использует стандартный парсер getopt_long_only --reasm-disable=[type[,type]] ; отключить сборку фрагментов для списка пейлоадов : tls_client_hello quic_initial . без аргумента - отключить reasm для всего. DESYNC ENGINE INIT: - --writeable[=] ; создать директорию для Lua с разрешением записи и поместить путь к ней в переменную env "WRITEABLE" (только одна директория) + --writable[=] ; создать директорию для Lua с разрешением записи и поместить путь к ней в переменную env "WRITABLE" (только одна директория) --blob=:[+ofs]@|0xHEX ; загрузить бинарный файл или hex строку в переменную Lua . +ofs задает смещение от начала файла --lua-init=@| ; однократно при старте выполнить Lua код из строки или из файла. поддерживаются сжатые gzip файлы. автоматически проверяется ".gz" --lua-gc= ; интервал вызова сборщика мусора Lua в секундах. 0 отключает периодический вызов. @@ -1139,8 +1139,8 @@ Windows : - Безвозвратно убираются все Se* привилегии из токена, кроме SeChangeNotifyPrivilege. - С помощью Job запрещается создание дочерних процессов и ограничивается взаимодействие с десктопом - clipboard, change desktop, change display settings и тд -Есть простой способ передать Lua коду каталог, доступный на запись - параметр `--writeable[=]`. -nfqws2 создает каталог, назначает на него такие права, чтобы Lua код смог писать туда файлы, передает имя директории в переменной env `WRITEABLE`. +Есть простой способ передать Lua коду каталог, доступный на запись - параметр `--writable[=]`. +nfqws2 создает каталог, назначает на него такие права, чтобы Lua код смог писать туда файлы, передает имя директории в переменной env `WRITABLE`. Если dirname не задан, на Windows создается каталог внутри `%USERPROFILE%/AppData/LocalLow` Со стороны Lua убираются опасные функции - os.execute, io.popen, package.loadlib и модуль debug. @@ -1844,8 +1844,8 @@ data задается при запуске таймера через [timer_set | env | Назначение | | :-------- |:---------- | -| WRITEABLE | Директория, доступная на запись Lua. Результат опции `--writeable` | -| APPDATALOW | (только Windows) Расположение AppData для low mandatory level. Сюда тоже можно записывать, но предпочтительно использовать `--writeable` для кросс-платформенности. | +| WRITABLE | Директория, доступная на запись Lua. Результат опции `--writable` | +| APPDATALOW | (только Windows) Расположение AppData для low mandatory level. Сюда тоже можно записывать, но предпочтительно использовать `--writable` для кросс-платформенности. | ## C функции @@ -3468,13 +3468,13 @@ function host_or_ip(desync) ``` function is_absolute_path(path) function append_path(path,file) -function writeable_file_name(filename) +function writable_file_name(filename) ``` - is_absolute_path возвращает true, если путь path начинается с корня. Учитываются особенности путей CYGWIN. - append_path дописывает имя файла или каталога file к пути path, разделяя их знаком '/' -- writeable_file_name возвращает filename, если filename содержит абсолютный путь или env `WRITEABLE` отсутствует. -Иначе берется путь из env `WRITEABLE` и к нему дописывается имя файла filename через append_path. +- writable_file_name возвращает filename, если filename содержит абсолютный путь или env `WRITABLE` отсутствует. +Иначе берется путь из env `WRITABLE` и к нему дописывается имя файла filename через append_path. ## Чтение и запись файлов diff --git a/lua/zapret-lib.lua b/lua/zapret-lib.lua index 3667934..9277f8f 100644 --- a/lua/zapret-lib.lua +++ b/lua/zapret-lib.lua @@ -1,4 +1,4 @@ -NFQWS2_COMPAT_VER_REQUIRED=5 +NFQWS2_COMPAT_VER_REQUIRED=6 if NFQWS2_COMPAT_VER~=NFQWS2_COMPAT_VER_REQUIRED then error("Incompatible NFQWS2_COMPAT_VER. Use pktws and lua scripts from the same release !") @@ -1435,9 +1435,9 @@ end function append_path(path,file) return string.sub(path,#path,#path)=='/' and path..file or path.."/"..file end -function writeable_file_name(filename) +function writable_file_name(filename) if is_absolute_path(filename) then return filename end - local writedir = os.getenv("WRITEABLE") + local writedir = os.getenv("WRITABLE") if not writedir then return filename end return append_path(writedir, filename) end diff --git a/lua/zapret-pcap.lua b/lua/zapret-pcap.lua index ee28390..ff979dc 100644 --- a/lua/zapret-pcap.lua +++ b/lua/zapret-pcap.lua @@ -15,8 +15,8 @@ function pcap_write(file, raw) pcap_write_packet(file, raw) end --- test case : --writeable=zdir --in-range=a --lua-desync=pcap:file=test.pcap --- arg : file= - file for storing pcap data. if --writeable is specified and filename is relative - append filename to writeable path +-- test case : --writable=zdir --in-range=a --lua-desync=pcap:file=test.pcap +-- arg : file= - file for storing pcap data. if --writable is specified and filename is relative - append filename to writable path -- arg : keep - do not overwrite file, append packets to existing function pcap(ctx, desync) if not desync.arg.file or #desync.arg.file==0 then @@ -24,7 +24,7 @@ function pcap(ctx, desync) end local fn_cache_name = desync.func_instance.."_fn" if not _G[fn_cache_name] then - _G[fn_cache_name] = writeable_file_name(desync.arg.file) + _G[fn_cache_name] = writable_file_name(desync.arg.file) if not desync.arg.keep then -- overwrite file os.remove(_G[fn_cache_name]) diff --git a/nfq2/darkmagic.c b/nfq2/darkmagic.c index 5106578..7c0567d 100644 --- a/nfq2/darkmagic.c +++ b/nfq2/darkmagic.c @@ -2478,11 +2478,11 @@ bool set_socket_buffers(int fd, int rcvbuf, int sndbuf) return true; } -bool make_writeable_dir() +bool make_writable_dir() { char wdir[PATH_MAX], *wrdir; - if (*params.writeable_dir) - wrdir = params.writeable_dir; + if (*params.writable_dir) + wrdir = params.writable_dir; else { #ifdef __CYGWIN__ @@ -2516,6 +2516,6 @@ bool make_writeable_dir() } } #endif - if (b) setenv("WRITEABLE",wrdir,1); + if (b) setenv("WRITABLE",wrdir,1); return b; } diff --git a/nfq2/darkmagic.h b/nfq2/darkmagic.h index 0aebaba..dccdf86 100644 --- a/nfq2/darkmagic.h +++ b/nfq2/darkmagic.h @@ -121,7 +121,7 @@ bool tcp_synack_segment(const struct tcphdr *tcphdr); bool tcp_syn_segment(const struct tcphdr *tcphdr); -bool make_writeable_dir(); +bool make_writable_dir(); bool ensure_file_access(const char *filename); #ifdef __CYGWIN__ extern uint32_t w_win32_error; diff --git a/nfq2/nfqws.c b/nfq2/nfqws.c index b9d2dce..a29ce06 100644 --- a/nfq2/nfqws.c +++ b/nfq2/nfqws.c @@ -1866,7 +1866,7 @@ static void exithelp(void) " --nlm-list[=all]\t\t\t\t\t; list Network List Manager (NLM) networks. connected only or all.\n" #endif "\nDESYNC ENGINE INIT:\n" - " --writeable[=]\t\t\t\t; create writeable dir for LUA scripts and pass it in WRITEABLE env variable (only one dir possible)\n" + " --writable[=]\t\t\t\t; create writable dir for LUA scripts and pass it in WRITABLE env variable (only one dir possible)\n" " --blob=:[+ofs]@|0xHEX\t\t; load blob to LUA var \n" " --lua-init=@|\t\t\t; load LUA program from a file or string. if multiple parameters present order of execution is preserved. gzipped files are supported.\n" " --lua-gc=\t\t\t\t\t\t; forced garbage collection every N sec. default %u sec. triggers only when a packet arrives. 0 = disable.\n" @@ -2003,7 +2003,7 @@ enum opt_indices { IDX_SOCKARG, #endif - IDX_WRITEABLE, + IDX_WRITABLE, IDX_BLOB, IDX_LUA_INIT, @@ -2107,7 +2107,7 @@ static const struct option long_options[] = { #elif defined(SO_USER_COOKIE) [IDX_SOCKARG] = {"sockarg", required_argument, 0, 0}, #endif - [IDX_WRITEABLE] = {"writeable", optional_argument, 0, 0}, + [IDX_WRITABLE] = {"writable", optional_argument, 0, 0}, [IDX_BLOB] = {"blob", required_argument, 0, 0}, [IDX_LUA_INIT] = {"lua-init", required_argument, 0, 0}, [IDX_LUA_GC] = {"lua-gc", required_argument, 0, 0}, @@ -2519,18 +2519,18 @@ int main(int argc, char **argv) } break; #endif - case IDX_WRITEABLE: - params.writeable_dir_enable = true; + case IDX_WRITABLE: + params.writable_dir_enable = true; if (optarg) { - if (!realpath_any(optarg, params.writeable_dir)) + if (!realpath_any(optarg, params.writable_dir)) { DLOG_ERR("bad file '%s'\n",optarg); exit_clean(1); } } else - *params.writeable_dir = 0; + *params.writable_dir = 0; break; case IDX_BLOB: @@ -3148,14 +3148,14 @@ int main(int argc, char **argv) DLOG_CONDUP("we have %u user defined desync profile(s) and default low priority profile 0\n", desync_profile_count); DLOG_CONDUP("we have %u user defined desync template(s)\n", desync_template_count); - if (params.writeable_dir_enable) + if (params.writable_dir_enable) { - if (!make_writeable_dir()) + if (!make_writable_dir()) { - DLOG_ERR("could not make writeable dir for LUA\n"); + DLOG_ERR("could not make writable dir for LUA\n"); exit_clean(1); } - DLOG("LUA writeable dir : %s\n", getenv("WRITEABLE")); + DLOG("LUA writable dir : %s\n", getenv("WRITABLE")); } #ifndef __CYGWIN__ if (params.droproot) diff --git a/nfq2/nfqws.h b/nfq2/nfqws.h index 7dbd4b3..71334fc 100644 --- a/nfq2/nfqws.h +++ b/nfq2/nfqws.h @@ -10,4 +10,4 @@ extern volatile sig_atomic_t bQuit; int main(int argc, char *argv[]); // when something changes that can break LUA compatibility this version should be increased -#define LUA_COMPAT_VER 5 +#define LUA_COMPAT_VER 6 diff --git a/nfq2/params.h b/nfq2/params.h index 2604d95..7436f78 100644 --- a/nfq2/params.h +++ b/nfq2/params.h @@ -190,8 +190,8 @@ struct params_s uint64_t payload_disable; struct str_list_head lua_init_scripts; - bool writeable_dir_enable; - char writeable_dir[PATH_MAX]; + bool writable_dir_enable; + char writable_dir[PATH_MAX]; timer_pool *timers; bool timers_dirty; // changed something in timers