Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-13 22:03:09 +00:00

zapret-auto: instances arg in condition, cond_lua

This commit is contained in:
bol-van
2026-02-09 17:24:11 +03:00
parent 41bac1833e
commit 6638140880
5 changed files with 89 additions and 18 deletions

View File

@@ -233,3 +233,6 @@ winws2: fixed lost windivert deinit on logical network disappear
nfqws2: handling of incoming fragmented packets (no reconstruct, raw ip payload)
zapret-auto: per_instance_condition orchestrator
zapret-auto: "instances" argument in condition orchestrator
zapret-auto: cond_tcp_has_ts, cond_lua iff functions
zapret-lib: replay_execution_plan and plan_clear max parameter

View File

@@ -226,6 +226,7 @@
- [cond_random](#cond_random)
- [cond_payload_str](#cond_payload_str)
- [cond_tcp_has_ts](#cond_tcp_has_ts)
- [cond_lua](#cond_lua)
- [Auxiliary programs](#auxiliary-programs)
- [ip2net](#ip2net)
- [mdig](#mdig)
@@ -3568,10 +3569,10 @@ Retrieves, removes, and returns the first element of the [execution plan](#execu
### plan_clear
```
function plan_clear(desync)
function plan_clear(desync, max)
```
Clears the [execution plan](#execution_plan) in `desync.plan` by removing all `instance` elements.
Clears up to the "max" instances if "max" is defined or the whole [execution plan](#execution_plan) in `desync.plan`.
### orchestrate
@@ -3585,10 +3586,10 @@ If `ctx=nil`, it does nothing, assuming the plan is already in `desync.plan`.
### replay_execution_plan
```
function replay_execution_plan(desync)
function replay_execution_plan(desync, max)
```
Executes the entire [execution plan](#execution_plan) from `desync.plan`, respecting the [instance cutoff](#instance_cutoff) and standard [payload](#in-profile-filters) and [range](#in-profile-filters) filters.
Executes up to the "max" instances if "max" is defined, or the entire [execution plan](#execution_plan) from `desync.plan`, respecting the [instance cutoff](#instance_cutoff) and standard [payload](#in-profile-filters) and [range](#in-profile-filters) filters.
# zapret-antidpi.lua DPI attack program library
@@ -4386,6 +4387,7 @@ function condition(ctx, desync)
- arg: `iff` - name of the [iff function](#iff-functions)
- arg: `neg` - invert the `iff` value; defaults to `false`
- arg: `instances` - how many following instances to execute conditionally. all if not defined.
`condition` calls `iff`. If `iff xor neg = true`, all instances in the `plan` are executed; otherwise, the plan is cleared.
@@ -4395,6 +4397,8 @@ function condition(ctx, desync)
function per_instance_condition(ctx, desync)
```
- arg: `instances` - how many following instances to execute conditionally. all if not defined.
All following instanced are called only if they have "cond" argument with the "iff" function name and it returns true. The "cond_neg" argument inverts "cond" result.
Names are not iff/neg to avoid conflict with other orchestrators.
@@ -4402,7 +4406,7 @@ Names are not iff/neg to avoid conflict with other orchestrators.
### stopif
```
function condition(ctx, desync)
function stopif(ctx, desync)
```
- arg: `iff` - name of the [iff function](#iff-functions)
@@ -4462,6 +4466,14 @@ function cond_tcp_ts(desync)
Returns `true` if the dissect is tcp and has tcp timestamp option.
#### cond_lua
```
function cond_lua(desync)
```
Executes a Lua code from the "code" argument. The code returns condition value. Direct addressing of the desync table is possible within the code.
# Auxiliary programs

View File

@@ -223,6 +223,7 @@
- [cond_random](#cond_random)
- [cond_payload_str](#cond_payload_str)
- [cond_tcp_has_ts](#cond_tcp_has_ts)
- [cond_lua](#cond_lua)
- [Вспомогательные программы](#вспомогательные-программы)
- [ip2net](#ip2net)
- [mdig](#mdig)
@@ -3747,10 +3748,10 @@ function plan_instance_pop(desync)
### plan_clear
```
function plan_clear(desync)
function plan_clear(desync, max)
```
Очищает [execution plan](#execution_plan) в desync.plan - удаляет все `instance`.
Очищает первые max инстансов, если max задан, либо весь [execution plan](#execution_plan) в desync.plan.
### orchestrate
@@ -3764,10 +3765,10 @@ function orchestrate(ctx, desync)
### replay_execution_plan
```
function replay_execution_plan(desync)
function replay_execution_plan(desync, max)
```
Выполняет весь [execution plan](#execution_plan) из desync.plan с учетом [instance cutoff](#instance_cutoff) и стандартных фильтров [payload](#внутрипрофильные-фильтры) и [range](#внутрипрофильные-фильтры).
Выполняет max инстансов, если max задан, либо весь [execution plan](#execution_plan) из desync.plan с учетом [instance cutoff](#instance_cutoff) и стандартных фильтров [payload](#внутрипрофильные-фильтры) и [range](#внутрипрофильные-фильтры).
# Библиотека программ атаки на DPI zapret-antidpi.lua
@@ -4566,6 +4567,7 @@ function condition(ctx, desync)
- arg: iff - имя [функции условия](#iff-функции)
- arg: neg - инвертировать значение iff. по умолчанию - false
- arg: instances - сколько последующих инстансов выполнять условно. все, если не задано.
condition вызывает iff. если iff xor neg = true, выполняются все инстансы plan, иначе план очищается.
@@ -4575,13 +4577,15 @@ condition вызывает iff. если iff xor neg = true, выполняют
function per_instance_condition(ctx, desync)
```
- arg: instances - сколько последующих инстансов выполнять условно. все, если не задано.
Все последующие инстансы вызываются только, если у них есть аргумент "cond", содержащий iff функцию, и она возвращает true. Аргумент "cond_neg" инвертирует ее значение.
Имена аргументов не iff/neg, чтобы исключить конфликт с другими оркестраторами.
### stopif
```
function condition(ctx, desync)
function stopif(ctx, desync)
```
- arg: iff - имя [функции условия](#iff-функции)
@@ -4641,6 +4645,14 @@ function cond_tcp_ts(desync)
Возвращает true, если диссект является tcp и присутствует timestamp tcp option.
#### cond_lua
```
function cond_lua(desync)
```
Выполняет Lua код из аргумента "code". Код возвращает значение условия через return. Возможна прямая адресация таблицы desync.
# Вспомогательные программы
## ip2net