Commit Graph

50 Commits

Author SHA1 Message Date
Gerald Combs 30c392f166 Tools+test: Call python3 explicitly.
PEP 394[1] says,

"In cases where the script is expected to be executed outside virtual
 environments, developers will need to be aware of the following
 discrepancies across platforms and installation methods:

  * Older Linux distributions will provide a python command that refers
    to Python 2, and will likely not provide a python2 command.

  * Some newer Linux distributions will provide a python command that
    refers to Python 3.

  * Some Linux distributions will not provide a python command at all by
    default, but will provide a python3 command by default."

Debian has forced the issue by choosing the third option[2]:

"NOTE: Debian testing (bullseye) has removed the "python" package and
 the '/usr/bin/python' symlink due to the deprecation of Python 2."

Switch our shebang from "#!/usr/bin/env python" to "#!/usr/bin/env
python3" in some places. Remove some 2/3 version checks if we know we're
running under Python 3. Remove the "coding: utf-8" in a bunch of places
since that's the default in Python 3.

[1]https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers
[2]https://wiki.debian.org/Python
2020-11-05 06:46:35 +00:00
Jeff Widman 8d7ebc732e Fix issues discovered by common python linters
Fix some issues discovered by common python linters including:
* switch `None` comparisons to use `is` rather than `==`. Identity !=
equality, and I've spent 40+ hours before tracking down a subtle bug
caused by exactly this issue. Note that this may introduce a problem if
one of the scripts is depending on this behavior, in which case the
comparison should be changed to `True`/`False` rather than `None`.
* Use `except Exception:` as bare `except:` statements have been
discouraged for years. Ideally for some of these we'd examine if there
were specific exceptions that should be caught, but for now I simply
caught all. Again, this could introduce very subtle behavioral changes
under Python 2, but IIUC, that was all fixed in Python 3, so safe to
move to `except Exception:`.
* Use more idiomatic `if not x in y`--> `if x not in y`
* Use more idiomatic 2 blank lines. I only did this at the beginning,
until I realized how overwhelming this was going to be to apply, then I
stopped.
* Add a TODO where an undefined function name is called, so will fail
whenever that code is run.
* Add more idiomatic spacing around `:`. This is also only partially
cleaned up, as I gave up when I saw how `asn2wrs.py` was clearly
infatuated with the construct.
* Various other small cleanups, removed some trailing whitespace and
improper indentation that wasn't a multiple of 4, etc.

There is still _much_ to do, but I haven't been heavily involved with
this project before, so thought this was a sufficient amount to put up
and see what the feedback is.

Linters that I have enabled which highlighted some of these issues
include:
* `pylint`
* `flake8`
* `pycodestyle`
2020-09-26 04:38:18 +00:00
Guy Harris 3417380d65 ncp: fix display of DS_FULL_CLASS_DEFS.
The last item in the reply information is an ACL.  Display it as such.
2020-09-15 04:04:33 -07:00
Guy Harris 395d2e7425 NCP: add more comments to tools/ncp2222.py.
Point to more NCP and NDS documentation.
2020-09-15 02:08:48 -07:00
Guy Harris 20ae645964 ncp: add a comment about possibly null-truncated strings.
In File Search Continue requests, the path is a single byte giving the
string length, followed by that many bytes containing the string value.

However, in at least some File Search Continue requests, the string
length value is longer than the string, and there's a NUL, followed by
other non-zero cruft, in the string.
2020-09-11 01:36:52 -07:00
Guy Harris 5cf3fd03f1 HTTPS In More Places, update some URLs.
Change-Id: Ice2e1e2e4d94f6c9da7c651866cfa1a8ac4a31d8
Reviewed-on: https://code.wireshark.org/review/34096
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 07:55:36 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Greg Morris 715f46b768 Updates to NCP protocol dissector
Add NCP 98
Fix NDSrequestprotocolflags not being captured on request so that reply
would offset correctly with CRC flag.

Change-Id: Ie45a1017326dd38393baf3f005f3ec9195438565
Reviewed-on: https://code.wireshark.org/review/33146
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-16 12:47:47 +00:00
Dario Lombardo fe71e26af2 spdx: more licenses converted.
Change-Id: I3861061ec261e63b23621799e020e811ed78a343
Reviewed-on: https://code.wireshark.org/review/26333
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 15:56:44 +00:00
Dario Lombardo c0d25e8a5d ncp: convert GHashTable to wmem_map_t.
Change-Id: I0de1c332a6052c20f6afbe1e51dfb14e18485891
Reviewed-on: https://code.wireshark.org/review/19899
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-02 15:33:20 +00:00
Michael Mann af54b292e6 Register reassembly tables
Register all reassembly tables with a central unit, allowing the
central unit to have the callback that initializes and destroys
the reassembly tables, rather than have dissectors do it individually.

Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4
Reviewed-on: https://code.wireshark.org/review/19834
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-29 13:29:04 +00:00
Alexis La Goutte a92058ec09 ncp2222.py: fix spelling typo found by lintian
Change-Id: If077e05568efc4dc8981da9558047fe147b5d139
Reviewed-on: https://code.wireshark.org/review/18486
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-26 20:13:53 +00:00
Guy Harris 099698445b Move the proto data stuff out of frame_data.[ch].
It's not tied to the frame_data structure any more, so it belongs by
itself.

Clean up some #includes while we're at it; in particular, frame_data.h
doesn't use anything related to tvbuffs, so don't have it gratuitiously
include tvbuff.h.

Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c
Reviewed-on: https://code.wireshark.org/review/13518
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-25 02:24:34 +00:00
Pascal Quantin 1a949ba87b NCP2222: change ncp.nds_return_all_classes filter type from FT_STRING to FT_UINT32
Otherwise a call to proto_tree_add_uint_format_value will trigger an assert

Bug: 11550
Change-Id: Ic30b07a424cd94b861cee8999b91154ceeb72469
Reviewed-on: https://code.wireshark.org/review/10689
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-29 21:48:42 +00:00
Michael Mann 3b04a89828 ncp2222: Use BASE_CUSTOM for date and time fields.
This simplifies some of the logic required for field formatting.

Change-Id: I2f9a612b18e3e4ca01311683d9cf61cbad9950f4
Reviewed-on: https://code.wireshark.org/review/10649
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-25 20:20:44 +00:00
Michael Mann a4a453b13d Convert dissect_nds_request and dissect_nds_reply to use proto_tree_add_xxx directly instead of the homegrown nds_val.
Change-Id: Ie67892caec2cddee591631045233f8a3f1cc0bc6
Reviewed-on: https://code.wireshark.org/review/10648
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-25 20:20:34 +00:00
Michael Mann ea2fcb552c Refactor NCP Python data so that INFO column can be generated on the fly (TAKE 2)
The "old" method of populating the INFO column was to dissect all fields of a function/subfunction, then do a search in the tree to find the hf_ values of interest to then format into something for the INFO column.  This is very expensive and requires "low level" APIs (for tree manipulation) which really shouldn't be used in a dissector.

The "new" method populates the INFO column at the same time a field is parsed, so nothing has to be revisited (and allows for more fields to be displayed on some malformed packets).

There are still expert infos (and possibly column APIs) under if (tree)s, but I'm not sure how FAKE_TREE_IS_VISIBLE factors into that.  Removing the FAKE_TREE_IS_VISIBLE seems to negatively affect dissection.

Change-Id: Ie487e851c2f6558dd12f0c7010757b4a5f36226b
Reviewed-on: https://code.wireshark.org/review/10631
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-25 11:36:41 +00:00
Michael Mann 961e0c0a25 Revert "Refactor NCP Python data so that INFO column can be generated on the fly."
This reverts commit 38b6f306a7.

Change-Id: I6ec83b94811be7699880e9a741c68faaac175bd0
Reviewed-on: https://code.wireshark.org/review/10613
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-22 20:06:12 +00:00
Michael Mann 38b6f306a7 Refactor NCP Python data so that INFO column can be generated on the fly.
The "old" method of populating the INFO column was to dissect all fields of a function/subfunction, then do a search in the tree to find the hf_ values of interest to then format into something for the INFO column.  This is very expensive and requires "low level" APIs (for tree manipulation) which really shouldn't be used in a dissector.

The "new" method populates the INFO column at the same time a field is parsed, so nothing has to be revisited.

There are still expert infos (and possibly column APIs) under if (tree)s, but with the FAKE_TREE_IS_VISIBLE "hacks" removed, there should be less fear in removing the tree checks.

Change-Id: I847827395fc28704f468df8bc8b47b297dde8479
Reviewed-on: https://code.wireshark.org/review/10572
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-19 08:15:10 +00:00
Michael Mann 2758114e0a Some more ncp2222 improvements
Including:
1. Using ENC_BIG_ENDIAN and ENC_LITTLE_ENDIAN instead of self made macros

2. Creating an "expert info hook" so that fields can be parsed "in real time" and added as expert info instead of searching by field name and manually getting values.  Most of the expert info is still under if (tree)s, but this is another step closer to removing all of the "manual labor" done that requires "special handling" of all tree functionality.  Once the "manual labor" is removed, this dissector can behave like every other dissector and the if (tree)s can be removed with more abandon.

Change-Id: If2c6a4c723e12e070e68d6df2d492d4b5ac35123
Reviewed-on: https://code.wireshark.org/review/10555
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-19 08:13:05 +00:00
Michael Mann 6646b00b5f ncp2222 - Convert process_bitfield -> proto_tree_add_bitmask and other cleanup.
The dissector is doing a lot of unnecessary "manual" operations.  Start the process of simplifying that to encourage use of general APIs and put control of the "field name" in the hands of the hf_ entry it belongs with.

Change-Id: I5b048c04858ac4a846a276ba12d61c665deb66f8
Reviewed-on: https://code.wireshark.org/review/10547
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-17 18:24:09 +00:00
gmor1207@gmail.com 5395a42ae4 ncp2222 Updates
Modifications to ncp2222.py

Add absolute time values eptime for file/volume info
Add support for 64 bit File Transfer NCP's (22/54, 22/55, 22/56, 22/57, 22/58, 87/70, 87/71, 87/72, 87/73, 89/41, 123/35)
Fix numerous dissection errors in NWInfo and ExtNWInfo structures
Fix some indention (white space) in source

Modifications to packet-ncp2222.inc
Change seq count rollover value to 16 instead of 255 to make it more robust
Add ncp 87,72 reply
Add ncp 8x20 request
Fix ncp 8x20 reply

Change-Id: I80bdcc5854c02edd4ea51c74aa0bbc9c0e062bc1
Reviewed-on: https://code.wireshark.org/review/10017
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2015-09-15 06:29:04 +00:00
Michael Mann 722174359e Eliminate proto_tree_add_text from packet-ncp2222.inc
Change-Id: I551204d7546c05ab277bbb299a44b4625475d1a0
Reviewed-on: https://code.wireshark.org/review/10501
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-12 20:00:20 +00:00
Alexis La Goutte 9a16a693cf NCP2222.py : fix generate indent (use 4 spaces)
Change-Id: Ibe55260e837f0a839649675c08e1bf66d8bcdb52
Reviewed-on: https://code.wireshark.org/review/9924
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-08-08 14:26:17 +00:00
Michael Mann 91515a0081 Add tshark -z "ncp,srt"
Change-Id: Iab2559c2bac5550987c108c6e917506fcec525e9
Reviewed-on: https://code.wireshark.org/review/8221
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-01 06:04:12 +00:00
Guy Harris 233dc643a6 Remove some apparently-unnecessary includes of emem.h.
Change-Id: Id50ce3e707056cca8f30052f05c451ce431b39b5
Reviewed-on: https://code.wireshark.org/review/6632
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:36:36 +00:00
Bill Meier 6e5d84f1e1 Rename some filter names to fix cases of duplicate filter names.
Note: Use of most of these filter names could have caused a Wireshark crash.

Change-Id: I393402a25dd26d174baff77f4706f6d5f43a94ae
Reviewed-on: https://code.wireshark.org/review/5610
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-04 03:44:45 +00:00
Jeff Morriss 82e2865739 Remove $Id$ and other Subversion leftovers from the tools.
There are a few things in here which could still use attention.

Don't regenerate anything now.

Change-Id: I283c224d3523212144707fca3d6265916cb11792
Reviewed-on: https://code.wireshark.org/review/205
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-14 01:35:57 +00:00
Anders Broman e8b935ad6e Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54209
2013-12-18 06:51:09 +00:00
Jakub Zawadzki cedb73c7f7 Dissectors should not use dfilter.h, don't include it.
XXX ncp2222 dissector is using dfilter_compile(), why?

svn path=/trunk/; revision=53766
2013-12-03 21:31:04 +00:00
Gerald Combs 4e2b6b13f6 Use 4-space (PEP 8) indentation. Add modelines.
svn path=/trunk/; revision=53685
2013-12-01 01:53:26 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Jakub Zawadzki 12d1509aa1 Move struct _ftype_t + callback typedefs + free macro to ftypes-int.h
svn path=/trunk/; revision=53223
2013-11-10 13:14:09 +00:00
Jakub Zawadzki 1899903f69 Include <epan/to_str.h> only when needed.
svn path=/trunk/; revision=53189
2013-11-09 13:41:10 +00:00
Michael Mann 306a110ed6 Add filterable expert info to NCP dissector.
svn path=/trunk/; revision=51833
2013-09-08 13:35:57 +00:00
Gerald Combs 97c9a9b9ba Make sure we're compatible with Python 2 + 3. Tested with Pythons 2.5,
2.7, and 3.3. The contents of packet-ncp2222.c are different after the
changes (e.g. some array contents are in a different order) but the
output of running 'tshark -nVxr' on the NCP files in the menagerie are
identical.

svn path=/trunk/; revision=51123
2013-08-02 16:34:31 +00:00
Gerald Combs a6131151f5 Use consistent "generated automatically" wording which will hopefully be
picked up by licensecheck.

svn path=/trunk/; revision=48812
2013-04-10 21:24:19 +00:00
Bill Meier a6e56df8b6 it's ==> its & its ==> it's as needed.
svn path=/trunk/; revision=47898
2013-02-26 02:38:52 +00:00
Bill Meier f9ecda41e4 Comment out a number of unused hf[] enrries found by checkhf.
svn path=/trunk/; revision=47670
2013-02-15 02:50:36 +00:00
Greg Morris 247040590d Added additional server information in NCP 23/17 reply structure for OES Linux.
Fixed GTKHash table being overwritten when number of NCP packets exceeds 255. Sequence numbers wrap so this was causing the request value table to be overwritten and subsequent malformed NCP packets.

Fixed buid_expert_data for file open reporting to correctly convert to Hex value so proper lookup in val table will succeed.

Added additional OES Linux values to build_expert_data for server entries.

svn path=/trunk/; revision=45177
2012-09-27 17:47:10 +00:00
Jeff Morriss 22b7086fb9 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=44997
2012-09-19 01:37:13 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Stig Bjørlykke 84bc28bd6a Introduce "Fragment count" filter element for all protocols doing reassembly.
svn path=/trunk/; revision=35705
2011-01-30 21:01:07 +00:00
Bill Meier 2f8ab63858 Compile (over 100) dfilters only if needed rather than at every Wireshark startup;
Also: Minor whitespace cleanup.

svn path=/trunk/; revision=34747
2010-11-01 18:38:13 +00:00
Bill Meier acccf6a77c Define some fcns & vars as static...
svn path=/trunk/; revision=34459
2010-10-10 20:14:34 +00:00
Guy Harris b535a07ea0 Added protocol name to "Reassembled length" text.
svn path=/trunk/; revision=31775
2010-02-02 23:31:13 +00:00
Guy Harris 05906068a5 Add a field for the reassembled length.
svn path=/trunk/; revision=31769
2010-02-02 17:48:41 +00:00
Guy Harris a1102bf55c Clean up white space.
svn path=/trunk/; revision=31768
2010-02-02 17:45:59 +00:00
Guy Harris 8e236e55de For fields of type FT_ABSOLUTE_TIME, have the "display" value be one of
ABSOLUTE_TIME_LOCAL or ABSOLUTE_TIME_UTC, indicating whether to display
the date/time in local time or UTC. (int)ABSOLUTE_TIME_LOCAL ==
(int)BASE_NONE, so there's no source or binary compatiblity issue,
although we might want to eliminate BASE_NONE at some point and have the
BASE_ values used with integral types start at 0, so that you can't
specify BASE_NONE for an integral field.

svn path=/trunk/; revision=31319
2009-12-19 03:17:44 +00:00
Jeff Morriss ee8f078374 Move all of the scripts in epan/dissectors/ to tools/ .
Add a target ("x11-dissector") to build the X11 dissector.

Put the X11-related files (back) in the source distribution.

svn path=/trunk/; revision=29871
2009-09-12 23:02:34 +00:00