Commit Graph

2019 Commits

Author SHA1 Message Date
Gabriel Potter 3390149230 Update some Windows links (#310)
Replaced links for PyWin32, Winpcap, pyreadline
2016-10-24 17:40:17 +00:00
Guillaume Valadon 7ecb148181 Merge pull request #307 from p-l-/end-25
Remove support for Python 2.5 to clean the code
2016-10-22 09:21:42 +02:00
Pierre LALET b2a7a54a35 Remove support for Python 2.5 to clean the code
- 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
2016-10-19 20:02:59 +02:00
Gabriel Potter 6c331b78aa Fixed windows circular import (#298)
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.
2016-10-18 08:44:43 +00:00
Pierre Lalet eaaf86aac6 Merge pull request #304 from felicitychou/sebek_patch
Fix sebek "command" field
2016-10-15 09:06:15 +00:00
fen 08e0f4f580 Update sebek.py 2016-10-14 20:00:33 +08:00
Pierre Lalet 923e8d1816 Merge pull request #303 from guedou/Issue_#301
Travis fails on OS X with pcap & dnet modules
2016-10-12 19:02:48 +00:00
Guillaume Valadon 4176d6ab2f Merge pull request #300 from domnikl/patch-1
Added missing` in introduction
2016-10-11 13:13:28 +02:00
Guillaume Valadon 535c159ca2 Use LOOPBACK_NAME 2016-10-11 13:10:29 +02:00
Dominik Liebler b8d6b08e8f Added missing` in introduction
Added missing ` to fix markup
2016-10-08 15:14:24 +02:00
Guillaume Valadon 8e08beeab8 Merge pull request #296 from p-l-/fix-circular-imports
Arch: move constant values to a new submodule
2016-09-27 14:23:07 +02:00
Pierre LALET d466c17729 Arch: factor LOOPBACK_NAME const
This avoids a circular import problem affecting Windows platforms.
2016-09-26 20:24:23 +02:00
Pierre LALET 32b710444f Arch: move constant values to a new submodule
This avoids a circular import problem affecting Windows platforms.
2016-09-26 20:01:00 +02:00
Pierre Lalet 3d027710b7 Merge pull request #293 from 6WIND/windows-arch-bugfix
arch/windows: fix circular import
2016-09-26 13:13:51 +00:00
Robin Jarry a300eac0e9 arch/windows: fix circular import
This fixes issue #277.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
2016-09-26 14:48:05 +02:00
Pierre Lalet 5c74229bcf Merge pull request #250 from 6WIND/ipsec-fuzz
layers/ipsec: fix padding problems with fuzzed packets
2016-09-23 09:30:11 +00:00
Pierre Lalet dd45615bf8 Merge pull request #292 from 6WIND/conf_routes
make sure that conf.route[6] is initialized before using it
2016-09-22 12:55:32 +00:00
Robin Jarry 8d58488f9b make sure that conf.route[6] is initialized before using it
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>
2016-09-22 14:32:43 +02:00
Guillaume Valadon cce88a93b0 Merge pull request #255 from zeronounours/profinet_rtc
Add PROFINET IO real-time layer
2016-09-15 16:58:03 +02:00
Gauthier Sebaux b69aaee738 Add PROFINET IO real-time layer
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
2016-09-12 17:23:31 +02:00
Philippe ROSE 33420f2494 ikev2 contrib improvements (#275) 2016-09-05 12:15:14 +00:00
Pierre Lalet 1c7e836c39 Merge pull request #272 from 6WIND/version-mgmt
enhance version management
2016-09-05 12:04:50 +00:00
Robin Jarry 4f71027fcd enhance version management
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>
2016-09-05 13:38:41 +02:00
Guillaume Valadon a2e8bb5da0 Merge pull request #288 from hkwi/dhcpv6_relay_udp_port
dhcp6: add DHCPv6-Relay default port
2016-09-05 09:10:41 +02:00
Pierre Lalet 93767ba7fa Merge pull request #284 from guedou/sessions_fixed
Pickling issues fixed
2016-09-04 23:11:06 +00:00
Pierre Lalet 095adbc1d1 Merge pull request #268 from guedou/python2.5_fix
Useless 'as' keyword breaks Python 2.5 compatibility
2016-09-04 23:08:47 +00:00
Kawai, Hiroaki 255b68b549 dhcp6: add DHCPv6-Relay default port
DHCPv6 serers and relay agents listen for DHCP messages
on UDP port 547 (rfc3315)
2016-09-02 12:35:14 +09:00
Guillaume Valadon 8a817801a7 Merge pull request #282 from alegacy/master
vxlan: fixed incorrect field layout specification
2016-08-31 14:03:52 +02:00
Guillaume Valadon 6a3a6cb714 Pickling issues fixed 2016-08-31 13:59:21 +02:00
Guillaume Valadon 6280482300 Merge pull request #276 from todfreed/master
dhcp6: fix the definition of DHCP6OptIAAddress, which does not have a…
2016-08-31 11:31:05 +02:00
Allain Legacy 9e276ec912 vxlan: fixed incorrect field layout specification
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>
2016-08-30 16:13:34 -04:00
Todd Freed bcbb66d808 dhcp6: fix the definition of DHCP6OptIAAddress, which does not have an iaid field
Testing:
Updated dhcp6 regression tests
2016-08-26 10:06:22 -07:00
Guillaume Valadon 7365c97710 Merge pull request #225 from GabrielGanne/nsh-update
NSH: first implementation and small update
2016-08-24 14:24:52 +02:00
Gabriel Ganne dbeb275816 NSH: First implementation
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>
2016-08-23 16:18:03 +02:00
Gabriel Ganne d7b900f569 VXLAN: add Generic Packet Encapsulation (GPE) support
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>
2016-08-22 11:42:36 +02:00
Guillaume Valadon 18f3a91c44 Useless 'as' keyword breaks Python 2.5 compatibility 2016-08-16 16:36:06 +02:00
Guillaume Valadon 5b5bd11933 Travis CI improvements (#258) 2016-08-12 11:36:08 +00:00
Guillaume Valadon 02ae08b4ad Workaround to ignore interfaces name truncated by netstat
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.
2016-08-12 11:35:02 +00:00
susengold 004b9f8c3b Import missing & mixup of psm status/result values in bluetooth.py #189 (#198)
* 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
2016-08-09 15:50:28 +02:00
plorinquer 164a52c075 NTP module update (#254)
* 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).
2016-08-05 08:02:11 +00:00
Robin Jarry 170700a4b8 VXLAN improvements (#247)
* 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>
2016-08-04 15:30:25 +02:00
Pierre Lalet d85738f71f Merge pull request #251 from X-Cli/clean_modbus
Rewrite of some modbus tests in a more pythonish and robust way
2016-08-03 18:02:33 +00:00
Florian Maury f65f1bacdf rewriting some modbus tests in a more pythonish and robust way 2016-08-03 19:43:07 +02:00
Pierre Lalet 550eea16ed Merge pull request #252 from X-Cli/ignore_pyo
Add .pyo to the ignored files
2016-08-03 15:01:29 +00:00
Florian Maury 7bc0bd9899 Add .pyo to the ignored files 2016-08-03 13:49:42 +02:00
Robin Jarry 876f5a3361 layers/ipsec: fix padding problems with fuzzed packets
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>
2016-08-02 14:46:29 +02:00
Pierre Lalet 9201f1cf13 Merge pull request #240 from 6WIND/lib-friendly
Make scapy usable as a third party library
2016-08-01 19:09:14 +00:00
Robin Jarry 4d31afe779 Only enable console logging when running interactive session
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>
2016-08-01 18:42:31 +02:00
Robin Jarry af35135c8c Prevent namespace pollution
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>
2016-08-01 18:42:31 +02:00
Robin Jarry 6057906368 Fix individual modules import
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>
2016-08-01 18:42:31 +02:00