diff --git a/docs/manual.en.md b/docs/manual.en.md index cb8c7f8..e9037f1 100644 --- a/docs/manual.en.md +++ b/docs/manual.en.md @@ -84,6 +84,7 @@ - [standard rawsend](#standard-rawsend) - [Dissection and reconstruction](#dissection-and-reconstruction) - [dissect](#dissect) + - [dissect_hdr](#dissect_hdr) - [reconstruct_dissect](#reconstruct_dissect) - [reconstruct_hdr](#reconstruct_hdr) - [csum_fix](#csum_fix) @@ -1054,6 +1055,10 @@ A blob is a binary data block of any size that can be loaded into a Lua variable Direct file operations from Lua code are not recommended unless absolutely necessary. Lua code runs with restricted privileges; intended operations might fail or behave inconsistently across different operating systems and environments. Blob loading occurs before entering the sandbox, providing a higher chance of success. +Since a blob's name is a Lua variable name, you cannot name it arbitrarily. You must follow Lua naming conventions. +For example, a variable name cannot start with a digit, contain non-alphanumeric characters (other than `_`), or use reserved words. +Names are case-sensitive. + ### In-profile filters These come in three types: `--payload`, `--in-range`, and `--out-range`. Filter values remain active from the moment they are specified until the next override. @@ -2150,6 +2155,20 @@ Returns a table representing the dissection of the `raw_ip` packet. This is the same operation that occurs automatically before desync functions are called based on the profile. Those functions receive an already prepared dissect. +#### dissect_hdr + +``` +function dissect_tcphdr(tcp) +function dissect_udphdr(udp) +function dissect_icmphdr(icmp) +function dissect_iphdr(ip) +function dissect_ip6hdr(ip6) +``` + +Dissection of individual raw headers. +Returns a table representing the dissected header. +For TCP options, all 0x00 options (padding) at the end are trimmed. + #### reconstruct_dissect ``` @@ -2187,6 +2206,7 @@ Reconstructs the corresponding raw headers from the dissect tables. Returns the - IPv6 reconstruction utilizes `reconstruct_opts`, specifically `ip6_preserve_next` and `ip6_last_proto`. - The IP header checksum is calculated automatically since it does not depend on any other components. - TCP, UDP and ICMP checksums are not calculated automatically because they depend on other components. +- TCP options are padded with 0x00 to a multiple of 4 bytes. #### csum_fix diff --git a/docs/manual.md b/docs/manual.md index 5643aa5..2ec5c66 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -81,6 +81,7 @@ - [standard rawsend](#standard-rawsend) - [Диссекция и реконструкция](#диссекция-и-реконструкция) - [dissect](#dissect) + - [dissect_hdr](#dissect_hdr) - [reconstruct_dissect](#reconstruct_dissect) - [reconstruct_hdr](#reconstruct_hdr) - [csum_fix](#csum_fix) @@ -1182,6 +1183,10 @@ Lua код вызывается в 3 местах. Lua код выполняется с ограниченными правами, задуманное может не получиться или не работать на разных ОС в разных условиях. Загрузка blob происходит до вхождения в песочницу, поэтому шансов на успех больше. +Поскольку имя блоба - это имя переменной Lua, нельзя назвать блоб как попало - должна соблюдаться конвенция имен Lua. +Например, нельзя начинать переменную с цифры, использовать не буквенно-цифровые символы, кроме `_`, или зарезервированные слова. +Имена чувствительны к регистру букв. + ### Внутрипрофильные фильтры Они бывают трех видов - `--payload`, `--in-range`, `--out-range`. @@ -2303,6 +2308,20 @@ function dissect(raw_ip) Это та же самая операция, что происходит автоматически до вызова desync функций по профилю. Они получают уже готовый диссект. +#### dissect_hdr + +``` +function dissect_tcphdr(tcp) +function dissect_udphdr(udp) +function dissect_icmphdr(icmp) +function dissect_iphdr(ip) +function dissect_ip6hdr(ip6) +``` + +Диссекция отдельных raw заголовков. +Возвращает таблицу - диссект заголовка. +В tcp options обрезаются все опции 0x00 с конца (padding). + #### reconstruct_dissect ``` @@ -2341,6 +2360,7 @@ function reconstruct_ip6hdr(ip6 [,reconstruct_opts]) - реконструкция ip6 задействует reconstruct_opts. из них берется ip6_preserve_next и ip6_last_proto. - чексумма ip header считается автоматически, поскольку ни от чего больше не зависит - чексуммы tcp, udp и icmp не считаются, поскольку зависят от других компонент +- tcp options дополняются 0x00 до кратности 4 байтам #### csum_fix