- update (part of) the documentation
- some URLs for Windows need to be updated
- update classifiers in setup.py
- remove `from __future__ import with_statement`
- use `{k: v for ...}` instead of `dict((k, v) for ...)`
- remove hacks for `gcd()` and `binrepr()` implementations
- use class decorators
- remove Python 2.6 Travis-CI tests
Moved all modifications to modules not needed in arch that were causing
crashed to another file next to __init__ (in arch.windows).
Fixed "run_tests.bat" crash: the old usage of the %DATE% param was no more supported.
To avoid circular import problems, conf.route and conf.route6 are
initialized in scapy.route and scapy.route6.
Make sure that these modules are imported before using conf.route[6].
This fixes issue #290.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
pnio:
* a base packet for PROFINET protocols which acts as a dispatcher based
on the frameID
pnio_rtc:
* Real-Time Cyclic layer
* includes a way to configure the layer to choose the right profile when
dissecting
* includes raw PROFINET data profile and PROFIsafe profile
* implements some heuristical methods to analyse and configure the real-time
layer
When making an official release of scapy, one must:
* Modify the hardcoded version in setup.py and scapy/config.py
* Create a commit with this change
* Create a git tag with the same version
* Run ./setup.py sdist register upload
* Modify the hardcoded version in setup.py and scapy/config.py again to
append '-dev'.
* Create another commit with the modified version.
* Push the 3 commits and the tag.
Not only this is tedious but it is also error prone.
Add utility functions in scapy/__init__.py to determine current version.
If git is available (thus running from a git clone), use "git describe" to
get the current version. Write the version for future reference to a
text file (scapy/VERSION).
If git is not available (running from an installed scapy package) read
the version from the scapy/VERSION file.
This changes the release process as follows:
* Create a git tag on the commit where you want to release
* Run ./setup.py sdist register upload
* Push the tag
This allows to have a single place where the version is managed: git.
Note: change the development versions to X.Y.Z.devN where N is the
number of commits after the last tag. This complies to PEP 440
https://www.python.org/dev/peps/pep-0440/#developmental-releases
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
The "NextProtocol" field was added as an unconditional field which made the
VXLAN packet header consume an additional 8-bts when used in a Legacy VXLAN
deployments (flags=0x08) or in GPID deployments (flags=0x88). The resulting
regression caused incorrect parsing of subsequent headers. For example, if an
Ethernet header followed the VXLAN header then it would not be interpreted as
an Ethernet header. The actually interpretation would depend on what value was
stored in the Ether.dst field.
This change updates the field layout specification such that the NextProtocol
field is conditional on flags=0x04, and shortens the reserved field by 8-bits
if that condition is true.
fixes bug #281
Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Add support for draft-ietf-sfc-nsh-05.txt
Original commit by: Christophe Fontaine <christophe.fontaine@qosmos.com>
Signed-off-by: Gabriel Ganne <gabriel.ganne@qosmos.com>
Since part of the previously reserved Bytes are now used to annouce
the next header, this also updates the vxlan unit tests.
Original commit by: Christophe Fontaine <christophe.fontaine@qosmos.com>
Signed-off-by: Gabriel Ganne <gabriel.ganne@qosmos.com>
When interface names are longer than 7 characters, netstat will truncate
them to the first 7 chars which leads to looking up an invalid interface
name.
We attempt to guess the name of the interface based on the output of
ifconfig -l. If there is only one candidate we consider it, otherwise we
ignore it.
* Fix missing import and mixup result / status in L2Cap Conn Resp
in scapy/layers/bluetooth.py
* Delete bluetooth.py
* fix missing import and mixup of result/status in L2Cap ConnResp
* Delete bluetooth.patch
* fixed missing import and mixup of result/status in L2Cap ConnResp
* Update bluetooth.py
* References to the 'Raw' class were replaced by conf.raw_layer.
* Fix potential infinite loop in NTPExtPacketListField::getfield() + typo.
* Added regression test (Extension dissection test).
* layers/vxlan: add group policy extension support
This is based on the following draft RFC:
http://tools.ietf.org/html/draft-smith-vxlan-group-policy-00
Add more unit tests in regression.uts.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
* Move VXLAN to layers
VXLAN has an official RFC: http://tools.ietf.org/html/rfc7348
It should be in automatically loaded layers.
Move tests to regression.uts.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
* load_contrib: fallback to layers when contrib not found
Useful when a scapy.contrib module has been moved to scapy.layers.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
When generating packets with fuzz(), some fields are not initialized
completely. This causes problems in evaluating the amount of padding
necessary to align the encrypted data length to a multiple of the crypto
algorithm block size.
This patch forces the encrypted packet fields to be resolved to their
default values before calculating the pad length.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
By default, only a NullHandler is added to the 'scapy' logger. This
allows third party applications that use scapy as a library to control
the logging of scapy messages.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
Some symbols are "internal" to modules (__all__, __file__, __doc__,
__package__, etc.) they should *not* be replaced by the one from other
modules.
The "from xxx import *" python syntax construct takes this into account
and only imports the "public" symbols (i.e., those whose name does not
start with an underscore). When a __all__ symbol is defined in a module
(it should be a list of strings), the "from xxx import *" construct only
imports the names listed in xxx.__all__.
Avoid shadowing module specific symbols when dynamically loading layers
and other modules by only importing "public" symbols.
Fix importing the "tls" layer along the way (remove erroneous __all__
definition).
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
When using scapy as a third party library, we do not "benefit" from the
loading routine that puts all symbols in the __builtin__ namespace. This
implies that all modules must be "importable" without any errors for
undefined symbols.
This patch fixes importing every scapy module individually. Some
circular imports were fixed (between inet6 and dhcp6).
Most errors were detected by using pylint with the right configuration
(scapy produces a *lot* of errors). Other errors were detected with the
following shell script:
export PYTHONPATH=".:$PYTHONPATH"
for f in $(find scapy/ -name '*.py'); do
f=${f%/__init__.py}
module=$(echo ${f%.py} | sed 's,/,.,g')
python -c "import $module; print $module"
done
Also, replace all implicit relative imports by absolute imports to avoid
surprises with some python versions.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>