aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-05-26Lua: Add lrexlib-pcre2 Lua regex bindingsJoão Valverde1-0/+3
Add the de facto standard Lua regex API to Wireshark. Upstream code is copied verbatim and the module opened in the "rex" table. This is just a user convenience and developer quality of life improvement over the GRegex Lua API because it has always been possible to load lrexlib-pcre2 as a Lua module from Wireshark.
2022-05-26Lua: Remove on-life-support GRegex bindingsJoão Valverde9-1475/+0
This code has been unmaintained and does not pass the lrexlib test suite. GRegex itself has been obsolescent for some time, although GNOME has recently restarted trying to move it to PCRE2. Remove it in preparation for a move to lrexlib-pcre2.
2022-05-26tcp: Split MSPs in out of order processingJohn Thacker1-24/+2
When processing segments out of order in TCP, it is possible to get new segments that fill a sequence gap and be able to dissect at least one PDU but need more data for additional PDUs (that have data from the contiguous stream bytes.) We can only determine this after passing the reassembled segments to the subdissector first. To keep dissection and layer numbers consistent between passes, split the multisegment PDU, keeping the already dissect PDU(s) in the current reassembly and creating a new MSP for the parts not yet dissected. Update the dissection test to enable the currently skipped test that require MSP splitting and remove test_tcp_out_of_order_twopass_with_bug
2022-05-23dfilter: Fix protocol slices with negative indexesJoão Valverde1-1/+5
Field infos have a length property that was not stored with the field value so when using a negative index the end was computed from the captured length of the frame tvbuff, leading to incorrect results. The documentation in wireshark-filter(5) describes how this was supposed to work but as far as I can tell it never worked properly. We now store the length and use that (when it is different from -1) to locate the end of the protocol data in the tvbuff. An extra wrinkle is that sometimes the length is set after the field value is created. This is the most common case as the majority of protocols have a variable length and dissection generally proceeds with a TVB subset from the current layer (with offset zero) through all remaining layers to the end of the captured length. For that reason we must use an expedient to allow changing the protocol length of an existing protocol fvalue, whenever proto_item_set_len() is called. Fixes #17772.
2022-05-12dfilter: Add support for universal quantifiersJoão Valverde1-1/+12
Adds the keywords "any" and "all" to implement the quantification to any existing relational operator. Filter: all tcp.port in {100, 2000..3000} Syntax tree: 0 ALL TEST_IN: 1 FIELD(tcp.port) 1 SET(#2): 2 FVALUE(100 <FT_UINT16>) 2 FVALUE(2000 <FT_UINT16>) .. FVALUE(3000 <FT_UINT16>) Instructions: 00000 READ_TREE tcp.port -> reg#0 00001 IF_FALSE_GOTO 5 00002 ALL_EQ reg#0 === 100 <FT_UINT16> 00003 IF_TRUE_GOTO 5 00004 ALL_IN_RANGE reg#0 in { 2000 <FT_UINT16> .. 3000 <FT_UINT16> } 00005 RETURN
2022-04-26dfilter: Add syntax to match specific layers in the protocol stackJoão Valverde2-0/+33
Add support to display filters for matching a specific layer within a frame. Layers are counted sequentially up the protocol stack. Each protocol (dissector) that appears in the stack is one layer. LINK-LAYER#1 <-> IP#1 <-> TCP#1 <-> IP#2 <-> TCP#2 <-> etc. The syntax allows for negative indexes and ranges with the usual semantics for slices (but note that counting starts at one): tcp.port#[2-4] == 1024 Matches layers 2 to 4 inclusive. Fixes #3791.
2022-04-21test: Remove libgcrypt checks for 1.8 and belowJohn Thacker2-79/+0
libgcrypt 1.8.0 or higher is required now, so remove the checks to skip tests without it
2022-04-18dfilter: Add abs() functionJoão Valverde1-0/+8
Add an absolute value function for ftypes.
2022-04-17ieee80211: Implement more KDEs from ieee802.11-2016 and on.Richard Sharpe1-1/+1
I have picked up more KDEs from ieee802.11-2016 and Draft P802.11REVmd_D5.0 and Draft P802.11be_D1.4.
2022-04-14dfilter: Add max()/min() tests and documentationJoão Valverde1-0/+24
2022-04-13tests: Remove leftover debug printJoão Valverde1-1/+0
2022-04-12Qt: Update our dynamic menu groups.Gerald Combs1-11/+16
Add log-specific statistics groups, and use them to limit the dynamic menu items in Wireshark and Logwolf.
2022-04-12tests: Add test for display filter field referenceJoão Valverde2-4/+36
2022-04-10dfilter: Create the syntax node in the scanner and pass thatJoão Valverde1-2/+2
Revert to passing a syntax node from the lexical scanner to the grammar parser. Using a union is not having a discernible advantage and requires duplicating a lot of properties of syntax nodes.
2022-04-08dfilter: Allow grouping arithmetical expressions with { }João Valverde1-0/+8
This removes the limitation of having only two terms in an arithmetic expression and allows setting the precedence using curly braces (like any basic calculator). Our grammar currently does not allow grouping arithmetic expressions using parenthesis, because boolean expressions and arithmetic expressions are different and parenthesis are used with the former.
2022-04-06dfilter: Fix RHS bias for literal valuesJoão Valverde1-0/+17
Fixes a3b76138f0e6ae25729337ed22125b092c439463.
2022-04-06dflter: Add testJoão Valverde1-0/+5
2022-04-06dfilter: Fix slice using range [:j]João Valverde1-0/+28
Fixes: $ dftest 'frame[:10] contains 0xff' dftest: ":10" is not a valid range.
2022-04-06dfilter: Clean up lexical scanningJoão Valverde1-0/+16
2022-04-06dfilter: Add more IPv6 testsJoão Valverde1-27/+39
2022-04-06tcp: Rework out of order dissection to dissect soonerJohn Thacker1-7/+3
Rework the out of order dissection to store the out of order segments and add them to reassemblies only after the gaps are filled. This allows reassembly of contiguous segments to be dissected when they can, instead of having to wait for all segment gaps to be filled. In cases where a segment has an erroneous later sequence number, this prevents reassembly from being completely halted. It is now guaranteed that when the subdissector is called that the segment from the current frame is either the first segment of the MSP or has bytes that were requested from the last call of the subdissector. This makes it easier to split MSPs in a later commit. MSPs now always have the first segment with the sequence number, so MSP_FLAGS_MISSING_FIRST_SEGMENT and first_frame_with_seq are obsolete and can be removed later. This fixes a long standing TODO in the out of order test in suite_dissection.py Dissection is more consistent between the first pass and later passes, though there is more to be done.
2022-04-06dfilter: Fix parsing of some IPv6 compressed addressesJoão Valverde1-0/+55
Fix parsing of some IPv6 addresses and add tests. Also pass tokens as unparsed unless the user was specfic about the semantic type. For example the IPv4 address 1.1.1.1 is also a valid field, but 1.1.1.1/128 is not (because of the slash). However choose not to enforce the distinction in the lexical scanner and pass everything as unparsed unless the meaning is explicit in the syntax with leading dot, colon, or between angle branckets.
2022-04-05dfilter: restore support for identifiers using hyphenJoão Valverde1-0/+10
Restores support for filters such as "mac-lte", that was broken in 330d40832848411da3c3d2646978e41240bf848b. This means we are not able to support arithmetic expressions with binary minus without spaces. $ dftest 'tcp.port == 1-2' dftest: "1-2" is not a valid number.
2022-04-04dfilter: Allow arithmetic expressions without spacesJoão Valverde1-0/+4
To allow an arithmetic expressions without spaces, such as "1+2", we cannot match the expression in other lexical rules using "+". Because of longest match this becomes the token LITERAL or UNPARSED with semantic value "1+2". The same goes for all the other arithmetic operators. So we need to remove [+-*/%] from "word chars" and add very specific patterns (that won't mistakenly match an arithmetic expression) for those literal or unparsed tokens we want to support using these characters. The plus was not a problem but right slash is used for CIDR, minus for mac address separator, etc. There are still some corner case. 11-22-33-44-55-66 is a mac address and not the arithmetic expression with six terms "eleven minus twenty two minus etc." (if we ever support more than two terms in the grammar, which we don't currently). We lift some patterns from the flex manual to match on IPv4 and IPv6 (ugly) and add MAC address. Other hypothetical literal lexical values using [+-*/%] are already supported enclosed in angle brackets but the cases of MAC/IPv4/IPv6 are are very common and moreover we need to do the utmost to not break backward compatibily here. Before: $ dftest "_ws.ftypes.int32 == 1+2" dftest: "1+2" is not a valid number. After: $ dftest "_ws.ftypes.int32 == 1+2" Filter: _ws.ftypes.int32 == 1+2 Instructions: 00000 READ_TREE _ws.ftypes.int32 -> reg#0 00001 IF_FALSE_GOTO 4 00002 ADD 1 <FT_INT32> + 2 <FT_INT32> -> reg#1 00003 ANY_EQ reg#0 == reg#1 00004 RETURN
2022-04-02dfilter: More arithmetic fixesJoão Valverde1-1/+10
Fix a failed assertion with constant arithmetic expressions. Because we do not parse constants on the lexical level it is more complicated to handle constant expressions with unparsed values. We need to handle missing type information gracefully for any kind of arithmetic expression, not just unary minus.
2022-03-31dfilter: Add binary arithmetic (add/subtract)João Valverde1-1/+17
Add support for display filter binary addition and subtraction. The grammar is intentionally kept simple for now. The use case is to add a constant to a protocol field, or (maybe) add two fields in an expression. We use signed arithmetic with unsigned numbers, checking for overflow and casting where necessary to do the conversion. We could legitimately opt to use traditional modular arithmetic instead (like C) and if it turns out that that is more useful for some reason we may want to in the future. Fixes #15504.
2022-03-29dfilter: Remove parenthesis deprecation warningJoão Valverde1-4/+0
This usage devalues a mechanism for warning users that deserves more attention than this minor suggestion. The warning is inconvenient for intermediate and advanced users.
2022-03-28dfilter: Add support for unary arithmeticJoão Valverde2-1/+30
This change implements a unary minus operator. Filter: tcp.window_size_scalefactor == -tcp.dstport Instructions: 00000 READ_TREE tcp.window_size_scalefactor -> reg#0 00001 IF_FALSE_GOTO 6 00002 READ_TREE tcp.dstport -> reg#1 00003 IF_FALSE_GOTO 6 00004 MK_MINUS -reg#1 -> reg#2 00005 ANY_EQ reg#0 == reg#2 00006 RETURN It is supported for integer types, floats and relative time values. The unsigned integer types are promoted to a 32 bit signed integer. Unary plus is implemented as a no-op. The plus sign is simply ignored. Constant arithmetic expressions are computed during compilation. Overflow with constants is a compile time error. Overflow with variables is a run time error and silently ignored. Only a debug message will be printed to the console. Related to #15504.
2022-03-28tests: Remove not implemented testsJoão Valverde1-3/+3
2022-03-28tests: Remove broken wslua gregex testsJoão Valverde1-8/+8
2022-03-28tests: Fix wslua regex parametersJoão Valverde1-1/+1
2022-03-28tests: Fix Kerberos detectionJoão Valverde1-1/+1
2022-03-23dfilter: Handle a bitwise expr on the RHSJoão Valverde1-4/+8
2022-03-22dfilter: Add bitwise masking of bitsJoão Valverde1-0/+16
Add support for masking of bits. Before the bitwise operator could only test bits, it did not support clearing bits. This allows testing if any combination of bits are set/unset more naturally with a single test. Previously this was only possible by combining several bitwise predicates. Bitwise is implemented as a test node, even though it is not. Maybe the test node should be renamed to something else. Fixes #17246.
2022-03-17test: Use integer tuple to check Gcrypt versionStig Bjørlykke1-4/+5
Converting Gcrypt version to float before checking against 1.6 does not work when Gcrypt version is 1.10 and above.
2022-03-14elastic: fix mapping with recent es versions.Dario Lombardo2-297/+294
2022-03-09extcap: new interface, wifidump, to capture Wi-Fi frames using a remote SSH hostAdrian Granados1-0/+4
2022-03-05dfilter: Require a field-like value on the LHSJoão Valverde2-11/+4
Comparisons require a field-like value on one of the sides, or both. Change this to require on the LHS or both. There is realy no reason that I can see to allow the relation to commute, and it allows removing a lot of unnecessary code and extra tests.
2022-03-05dfilter: Add RHS bias for literal valuesJoão Valverde1-2/+2
For unparsed values on the RHS of a comparison try to parse them first as a literal and only then as a protocol. This is more complicated in code but should be a use case a lot more common and useful in practice. It removes some annoying special cases and applies this rule consistently to any expression. Consistency is important otherwise the special cases and exceptions make the language confusing and difficult to learn. For values on the LHS the rule remains to first try a protocol value, then a literal. Related with issue #17731.
2022-03-05dfilter: Rename "unparsed" to "literal"João Valverde1-1/+1
A literal value is a value that cannot be interpreted as a registered protocol. An unparsed value can be a literal or an identifier (protocol/field) according to context and the current disambiguation rules. Strictly literal here is to be understood to mean "numeric literal, including numeric arrays, but not strings or character constants".
2022-03-05dfilter: Add special syntax for literals and namesJoão Valverde2-2/+16
The syntax for protocols and some literals like numbers and bytes/addresses can be ambiguous. Some protocols can be parsed as a literal, for example the protocol "fc" (Fibre Channel) can be parsed as 0xFC. If a numeric protocol is registered that will also take precedence over any literal, according to the current rules, thereby breaking numerical comparisons to that number. The same for an hypothetical protocol named "true", etc. To allow the user to disambiguate this meaning introduce new syntax. Any value prefixed with ':' or enclosed in <,> will be treated as a literal value only. The value :fc or <fc> will always mean 0xFC, under any context. Never a protocol whose filter name is "fc". Likewise any value prefixed with a dot will always be parsed as an identifier (protocol or protocol field) in the language. Never any literal value parsed from the token "fc". This allows the user to be explicit about the meaning, and between the two explicit methods plus the ambiguous one it doesn't completely break any one meaning. The difference can be seen in the following two programs: Filter: frame == fc Constants: Instructions: 00000 READ_TREE frame -> reg#0 00001 IF-FALSE-GOTO 5 00002 READ_TREE fc -> reg#1 00003 IF-FALSE-GOTO 5 00004 ANY_EQ reg#0 == reg#1 00005 RETURN -------- Filter: frame == :fc Constants: 00000 PUT_FVALUE fc <FT_PROTOCOL> -> reg#1 Instructions: 00000 READ_TREE frame -> reg#0 00001 IF-FALSE-GOTO 3 00002 ANY_EQ reg#0 == reg#1 00003 RETURN The filter "frame == fc" is the same as "filter == .fc", according to the current heuristic, except the first form will try to parse it as a literal if the name does not correspond to any registered protocol. By treating a leading dot as a name in the language we necessarily disallow writing floats with a leading dot. We will also disallow writing with an ending dot when using unparsed values. This is a backward incompatibility but has the happy side effect of making the expression {1...2} unambiguous. This could either mean "1 .. .2" or "1. .. 2". If we require a leading and ending digit then the meaning is clear: 1.0..0.2 -> 1.0 .. 0.2 Fixes #17731.
2022-03-01GRPC: Add support for gRPC-WebHuang Qiangxiong3-0/+162
Supporting both application/grpc-web and application/grpc-web-text. Add test case for grpc-web(-text). close #17939
2022-02-24dfilter: Add more testsJoão Valverde1-1/+13
Add more tests and fix a copy paste error with the test name.
2022-02-24Reword plugin info in About Wireshark dialogJoão Valverde1-1/+1
2022-02-23dfilter: Add a true/false boolean representationJoão Valverde1-0/+8
Minor code cleanup.
2022-02-23dfilter: Add support for binary literal constantsJoão Valverde1-0/+16
Example: 0b1001, 0B111000, etc.
2022-02-02Fix some too-narrow field types.Martin Mathieson1-1/+1
2022-02-02packet-smb2: add AES-256-* decryptionStefan Metzmacher3-2/+64
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-01-23asterix: output format fixZoran Bošnjak1-39/+39
Use HEX, DEC, HEX_DEC..., depending on item size and byte alignment.
2022-01-12test: Update text2pcap test to use new hexdump optionJohn Thacker1-7/+9
Update the text2pcap tests to use the new tshark hexdump option (see b5f89dbe2db357a0 ), which allow us to get a consistent roundtrip of results instead of having to override the expected number of packets and data size.