Commit Graph

424 Commits

Author SHA1 Message Date
Pierre LALET c2cc5002e6 Do not load tls module by default 2017-08-20 04:10:18 +02:00
gpotter2 1ab1cd44d3 Fix little-big endian dissection issue 2017-08-11 12:03:43 +02:00
Pierre Lalet 695913c5ae Merge pull request #624 from jsebechlebsky/ppp_auth
Improve PPP Authentication support
2017-08-09 07:15:17 +02:00
Jan Sebechlebsky 955c5b14a3 Add tests for PPP CHAP layer 2017-08-06 17:28:11 +02:00
Jan Sebechlebsky ca4b6396f1 Add tests for PPP PAP layer 2017-08-06 17:28:10 +02:00
Guillaume Valadon 996042c30d DNS TSIG Ressource Record 2017-08-02 14:02:13 +02:00
gpotter2 66d692d232 Add VRRP chksum test 2017-07-31 15:48:26 +02:00
Pierre Lorinquer 310e468dd9 EAP_TTLS class added in eap.py. Regression tests have also been added to the regression.uts file.
Add a mysummary() method to the EAP class.
2017-07-24 09:10:53 +02:00
gpotter2 679dc6e4ea Add missing coma 2017-07-24 08:23:49 +02:00
Pierre Lalet a8decd0518 Merge pull request #694 from guedou/Issue_#529
Don't call randval() on unused ConditionalField
2017-07-20 14:45:17 +02:00
gpotter2 fb02085ceb Fix defragment/defrag on real DNS packets 2017-07-19 14:34:19 +02:00
Guillaume Valadon d2db85948a Don't call randval() on unused ConditionalField 2017-07-13 11:44:19 +02:00
Pierre Lalet f937cccf72 Merge pull request #675 from gpotter2/select-semaphores
[Speed up] Use passive form to select.select + Fix pipetools.uts
2017-07-13 09:51:09 +02:00
mtury 72720872d4 [TLS] Major module overhaul (#542)
* TLS module major overhaul

* Clean TLS directory

* TLS 1.3 packets and basic client automaton (+ session fixes)

* Fix multiple key share entries

* Convergence py3

* Support features from cryptography v2.0

* Validate CertificateVerify signatures

* Small fix on TLS signature parsing

* Small fixes in TLS module

* Enhance Encrypted PMS support

* Convergence py3 - print

* Revert useless changes

* Strengthen crypto lib validation
2017-07-06 07:52:04 +02:00
gpotter2 bb2df99080 Update StringIO 2017-06-29 16:03:44 +02:00
gpotter2 5f3080bc2d Remove __cmp__ (fix tests) 2017-06-29 16:03:44 +02:00
Guillaume Valadon 4f45d40193 Merge pull request #693 from gpotter2/fix-tests-1
[tests] Remove stuck test
2017-06-28 11:58:15 +02:00
gpotter2 299bd5e08d Use correct manufdb on windows 2017-06-27 23:02:41 +02:00
gpotter2 22a55b62eb [Python 2 to 3] Main six fixes (#630)
* Apply six fixes
* Include six directly in scapy
* Ignore six library in coverage
* Moved winpcapy to modules
* Iterator and list fixes
2017-06-27 18:31:14 +02:00
gpotter2 416b2fdaac Comment-out crashy test 2017-06-27 13:31:20 +02:00
gpotter2 701ef0e566 Improve Dot11 coverage + bug fixes 2017-06-26 11:41:43 +02:00
gpotter2 e5084df44c Disable cymru AS_resolver test 2017-06-22 16:38:57 +02:00
gpotter2 653d114f04 [coverage] Several tests + coverage stability (#637)
* Simplify construct_source_candidate_set

* New tests: _CipherSuitesField and construct_source_candidate_set

* Fix run_tests.bat

* New nmap.uts tests

* Add LLMNR tests

* Add TLS failing tests

* STP, linux + bpf random tests

* Add DHCP6 tests
2017-06-22 10:19:02 +02:00
gpotter2 0bfed5c578 Use passive form to select.select 2017-06-07 15:09:07 +02:00
Guillaume Valadon f618886810 Merge pull request #676 from gpotter2/fix-pypy-tests1
Fix pipetools tests
2017-06-07 08:44:41 +02:00
Guillaume Valadon 3a2d7bb846 Some unit tests (#670) 2017-06-06 13:39:33 +02:00
gpotter2 85e91cf2d0 Reduce waiting time in tests 2017-06-05 14:03:43 +02:00
Pierre Lalet 6db9cf9fb9 Merge pull request #639 from gpotter2/windows-pipetools
[Pipetools/coverage] Make pipes work on windows + add tests
2017-06-01 10:19:41 +02:00
plorinquer c8bc0446ae RADIUS module update. (#627)
* The authenticator field is now a XStrFixedLenField (this improves its readability when displayed using show() or show2()).

* RADIUS module update.

* The description of the compute_message_authenticator() method (RadiusAttr_Message_Authenticator class) has been edited.

* The "Response Authenticator computation" test requires the Cryptography library.

* Fix attribute names in compute_message_authenticator().

* Applied guedou's comments.

Specify field length in the Message-Authenticator attribute.
2017-06-01 08:36:06 +02:00
Neale Ranns cc02b632bb MPLS label layering/stacking clears the EOS bit
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-05-31 23:35:08 +02:00
gpotter2 0ef62bfe31 Change line ending of unix to dos files 2017-05-31 17:05:39 +02:00
gpotter2 6178b48843 Added high push tests + drainers 2017-05-31 13:36:25 +02:00
gpotter2 37b8c8237a Add more coverage: operators and logic 2017-05-31 13:36:25 +02:00
gpotter2 1998f2f655 More pipetool tests 2017-05-31 13:36:24 +02:00
gpotter2 b0266116b2 Add pipetool tests 2017-05-31 13:35:29 +02:00
gpotter2 949ea2fa3b Minor formatting improvements 2017-05-31 13:33:25 +02:00
gpotter2 1306fd897b Add tests 2017-05-31 13:33:25 +02:00
Pierre Lalet 3123e90157 Merge pull request #618 from guedou/codecov_14
[coverage] More tests for inet.py
2017-05-02 13:47:59 +02:00
Pierre LALET ddc4359b86 Cleanup Nmap module, add tests 2017-04-28 23:26:38 +02:00
Guillaume Valadon 84d5cf965a TCP automaton unit tests on Linux 2017-04-27 11:38:33 +02:00
Guillaume Valadon 04b05ed5f5 Test report_ports() using mock 2017-04-25 16:49:45 +02:00
gpotter2 d02b7f5bf2 New tests to avoid randomness of coverage 2017-04-22 19:48:24 +02:00
Pierre Lalet 7476e93141 Merge pull request #553 from Leereen/sctp-enhance
[SCTP] RFC 4895 & 5061
2017-04-19 16:11:27 +02:00
Guillaume Valadon dcd1b911c0 Merge pull request #613 from p-l-/fix-bitfield-len
Fields/BitField: implement .i2len()
2017-04-19 11:04:15 +02:00
Pierre Lalet 4af8e3a4ed Merge pull request #609 from gpotter2/random-coverage
[coverage] Small tests
2017-04-18 23:13:49 +02:00
gpotter2 0ef96fa9cb Add new tests that do not depend on sniffing
to reduce the randomness of coverage
2017-04-18 22:55:32 +02:00
Pierre Lalet 575a582e2f Merge pull request #586 from plorinquer/eap-fixes
EAP - fix variable length field computation
2017-04-18 22:14:32 +02:00
Pierre Lalet 8c56c54fa7 Merge pull request #599 from gpotter2/fix-windows-routes
[Routing/Windows] Improve routing system
2017-04-18 21:22:28 +02:00
Pierre Lorinquer 3adc44e65b LEAP - (Cisco) Lightweight EAP support added. 2017-04-18 14:07:57 +02:00
Pierre LALET 0227a5157c Fields/BitField: implement .i2len() 2017-04-17 14:56:20 +02:00
gpotter2 3288e99073 IPv6 support for Windows 7 + no powershell 2017-04-16 23:14:14 +02:00
Pierre Lalet 535885ed52 Merge pull request #606 from guedou/codecov_12
[coverage] Answering machines unit tests
2017-04-13 13:46:12 +02:00
Guillaume Valadon 01ac767be7 Answering machines unit tests 2017-04-13 11:25:05 +02:00
Lucas Pascal 46eac33866 [fix] requested correction 2017-04-13 08:50:30 +02:00
Guillaume Valadon c8289a7feb More tests for scapy/*.py files 2017-04-12 17:29:18 +02:00
Pierre Lalet 2868fa8703 Merge pull request #601 from guedou/smaller_ut_results
Smaller unit tests results
2017-04-10 17:34:17 +02:00
Guillaume Valadon 4bbee3b741 [coverage] More unit tests for scapy/*.py & bug fixes (#522)
* Code cleaning, unit tests
* Fix manuf DB path
* Specify seed in volatile objects using RandomEnumeration
* pypy fixes
2017-04-10 17:33:08 +02:00
Guillaume Valadon 5e0fe43f47 Smaller unit tests results 2017-04-10 15:48:19 +02:00
Lucas Pascal d8a0387bdd [test] basic SCTP testing 2017-04-10 11:23:32 +02:00
gpotter2 db7c9c1d87 Fix duplicated function + test 2017-04-09 13:07:54 +02:00
gpotter2 43af87fc49 Improve routes on windows 2017-04-09 13:07:54 +02:00
Thomas Faivre 8ea9b84b4a test/ipsec: add reference packet to check decryption
Currently, only internal encryption and decryption were tested but the
implementation might not be the on it is supposed to be.

Add reference packets generated using Ubuntu-16.04, iproute2 and ping:
 # ip -V
 ip utility, iproute2-ss151103
 # uname -a
 Linux router-vm 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
 # ping -V
 ping utility, iputils-s20160308

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2017-04-06 13:00:57 +02:00
Thomas Faivre e430ef6386 tests: fix some AES-CCM tests
In TLS, the AES-CCM test is commented out because CCM is not supported
by cryptography. But the combined_modes_ccm keyword is made to skip
these tests.

In IPsec, some IPv4 tests are located in the IPv6 section. Also add the
same combination of test for the AES-CCM as the other modes.

Also, there is some errors in the key material as the *MUST*
implementation uses a 16 bytes key and a 3 bytes nonce. Fix those
lengths.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2017-04-06 13:00:57 +02:00
Guillaume Valadon 1bb5499190 Support Raw IPv6 as PCAP linktype 2017-03-30 09:05:13 +02:00
Pierre Lalet 77b4ce3af4 Merge pull request #576 from guedou/PR#504_improved
[rewritten] PR #504
2017-03-29 12:10:05 +02:00
Pierre Lorinquer 2cd6d3347f Fix EAP_MD5 "len" field computation.
The default values of the "value_size" field is None. This can trigger
an issue
when computing the "len" field.

Test: str(EAP_MD5())

In order to fix this issue, the default value of the "value_size" field
has been set to 0.

Tests have been added in "regression.uts".

Added regression tests for EAP_TLS and EAP_FAST.

Use XStrLenField in EAP_MD5, EAP_TLS and EAP_FAST packets instead of StrLenField.

Delete blank lines before the class description (EAPOL, EAP, EAP_MD5, EAP_TLS and EAP_FAST packet classes).

"registered_options" dictionary was renamed "registered_methods"
(EAP-MD5, EAP-TLS etc are not options, but authentication methods).

EAP getlayer() and haslayer() methods have been overloaded in order to
allow access to a given "EAP layer" (such as EAP_TLS, for instance) by
providing the parent class name ("EAP"). For example, this is now
possible:

>>> eap_tls = EAP_TLS()
>>> EAP_TLS in eap_tls
True
>>> EAP in eap_tls
True
>>> eap_tls[EAP_TLS]
<EAP_TLS  |>
>>> eap_tls[EAP]
<EAP_TLS  |>

Regression tests have been added.
2017-03-28 21:36:16 +02:00
Thomas Faivre c73cdbc5f2 layers/ipsec: fix AH dissection
The ICV size is defined by the authentication algorithm in the SA.
it can be deduced from the payloadlen field but the padding len is
unknown aswell so there is no way to find both without the SA.

Assume everything in payloadlen is the ICV until the verification called
from the SA. Fill padding when possible.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2017-03-28 11:35:12 +02:00
Guillaume Valadon 1ab629e4d4 Small fix and unit tests 2017-03-23 16:09:05 +01:00
Pierre LALET a6e2c2f3cb Prevent sr() tests crashes 2017-03-22 08:24:44 +01:00
Pierre Lalet 037c992d29 Merge pull request #572 from gpotter2/scpy-30-prog
[convergence] Python 3- string byte tag
2017-03-22 07:21:59 +01:00
gpotter2 d2d7d2dac9 Auto parser on tests 2017-03-21 22:38:45 +01:00
gpotter2 3b36b636b6 Fix mock_windows tests 2017-03-20 21:03:41 +01:00
Guillaume Valadon a7a164350d Merge pull request #516 from plorinquer/ntp-update
NTP : update and small fixes
2017-03-16 09:13:16 +01:00
Pierre Lalet 0c7ad603d7 Merge pull request #558 from guedou/PR#182_improved
[rewritten] PR #182
2017-03-15 17:25:05 +01:00
Guillaume Valadon 996b02e6f1 Merge pull request #528 from gpotter2/patch-7
[coverage] Tests for ManufDB + Multiple fixes
2017-03-15 15:03:27 +01:00
Guillaume Valadon 597f30bea7 Merge pull request #537 from gpotter2/pickling-error
[Pickling] Add packets pickling support
2017-03-15 15:02:29 +01:00
Guillaume Valadon 35354325a8 Improved Segment Routing Header support - draft-06 2017-03-15 14:29:36 +01:00
gpotter2 911f1d6c45 Better tests + fixes 2017-03-15 13:17:49 +01:00
gpotter2 8666c13183 Only test ManuFDB when available 2017-03-15 13:17:49 +01:00
gpotter2 81fc163513 Added some windows arch tests 2017-03-15 13:17:48 +01:00
gpotter2 ab08f45646 Fix manufdb detection on windows 2017-03-15 13:15:11 +01:00
gpotter2 8fbcf84614 Added client tls tests on appveyor 2017-03-15 13:15:10 +01:00
Pierre Lalet 7d9004373b Merge pull request #498 from gpotter2/patch-windows-tests
[Windows] Fixed VBS fallback
2017-03-13 13:51:08 +01:00
gpotter2 f3016aca7c Add pickling methods 2017-03-11 01:38:28 +01:00
Guillaume Valadon caff8ac253 Better unit tests for inet6.py 2017-03-10 13:05:35 +01:00
Guillaume Valadon 4d8b461e69 Merge pull request #545 from p-l-/enh-flags
Flags: allow operations (| & ==) with strings
2017-03-10 12:59:01 +01:00
Pierre Lalet f982008e7a Merge pull request #543 from gpotter2/multi-utscapy
[coverage] Speed up all tests x2
2017-03-10 08:24:53 +01:00
Pierre Lalet 3f0ec99b54 Merge pull request #548 from gpotter2/fix-as-resolver
[Tests] Fix AS_RESOLVER
2017-03-09 22:37:25 +01:00
Pierre LALET 53a66dee44 Add tests for TCP.answers() 2017-03-09 13:47:59 +01:00
gpotter2 d5670e8b38 Fix AS_RESOLVER 2017-03-06 20:55:03 +01:00
Pierre LALET a6b12fc6eb Flags: allow operations (| & ==) with strings: pkt[TCP].flags |= "SA" 2017-03-06 07:56:52 +01:00
gpotter2 f2201b7f82 Add UTscapy multi-file support 2017-03-05 02:14:36 +01:00
Victor Pfautz 0d92fc9fbb Fixed spacing bug (#532)
Fixed some typos and bad whitespaces.
2017-03-01 13:08:36 +01:00
Pierre LALET 4e4ea3a59e Tests: disable debug_dissector in sniff tests
This should avoid random unrelated crashes.
2017-02-22 10:22:20 +01:00
Pierre Lalet 0d4151a118 Merge pull request #509 from guedou/codecov_8
[coverage] Better unit tests for inet.py
2017-02-16 20:10:49 +01:00
Pierre Lorinquer 99214c1ca8 NTPControl: rename field 'error' in 'err' in order to have the same name for the error field in NTP Control messages and NTP Private messages.
Use the XStrFixedLenField class which is now defined in scapy/fields.py + Fix typo.
2017-02-16 15:04:51 +01:00
gpotter2 e658e64c2b [Windows/coverage] Fix and Support automaton (#496) 2017-02-14 23:28:57 +01:00
gpotter2 59b16b4577 [TLS/coverage] Migrate to UTS + Bug (#508) 2017-02-14 23:26:42 +01:00
mtu 7b880de63b Enable DES and EXP-DES for TLS 2017-02-10 14:48:27 +01:00
Guillaume Valadon 2f8d8b8e51 Better unit tests for inet.py 2017-02-10 13:53:30 +01:00
mtu 9f11fbf308 Enable RSA and ECDSA key generation 2017-02-08 15:39:50 +01:00
mtu 0900b82024 Add OCSP ASN.1 packets 2017-02-08 15:39:50 +01:00
mtu 03f612aa82 Use python-cryptography for TLS 2017-02-08 15:39:50 +01:00
mtu 1bc79c805b Add TLS parsing/building support, TLS basic automatons, TLS tests 2017-02-08 15:39:50 +01:00
gpotter2 e7932e63fa [coverage] Improved main.py tests (#478)
* Improved main.py tests

* Small fixes
2017-02-08 14:44:38 +01:00
Guillaume Valadon 97af816569 Merge pull request #493 from guedou/codecov_6
[coverage] Tests for scapy/asn1/*
2017-02-07 14:41:04 +01:00
Guillaume Valadon 63d2c120fc Merge pull request #442 from X-Cli/cb_enum
Add callbacks to EnumFields for large ranges
2017-02-07 13:39:19 +01:00
mtu e758a218ea Ask for python-cryptography v1.7+ in warnings and documentation 2017-02-07 10:56:49 +01:00
Florian Maury c8261e4dc7 Adding callbacks to EnumField and lots of EnumField tests
- this feature allows conversion of large ranges where
    all entries coalesce to the same representation without bloating
    a dict. For instance, 0x0 to 0xffff all display as "toto" except
    a few odds 0x2 which are displayed as "tutu".
    Before this feature, you needed to write
    enum = {x: 'toto' for x in xrange(0, 0xffff)
    enum[2] = 'tutu'
    XShortEnumField('test', 0, enum)
2017-02-07 10:18:43 +01:00
Florian Maury 784f44c880 Moving into another file the unit tests related to fields 2017-02-07 10:18:41 +01:00
gpotter2 40ad5b67b1 Fix VBS fallback 2017-02-03 19:32:34 +01:00
Guillaume Valadon 3642cb9533 Merge pull request #438 from mtury/master
Fix issue #408 : complex ASN1 fields randval()
2017-02-03 16:25:26 +01:00
Pierre Lalet afec3130e3 Merge pull request #480 from jsebechlebsky/pptp_support
PPTP support (Enhanced GRE, PPP LCP, PPTP Control Connection)
2017-02-02 18:24:07 +00:00
mtu 9888e6c471 Fix complex ASN1 fields randval() 2017-02-01 13:36:22 +01:00
Guillaume Valadon 00101f0a72 Tests for scapy/asn1/* 2017-02-01 13:28:56 +01:00
Guillaume Valadon a6589c9f18 Dot11 unit tests 2017-01-31 12:57:35 +01:00
Jan Sebechlebsky 836390ee15 Add PPTP related tests 2017-01-31 11:31:17 +01:00
Guillaume Valadon 67ee2f3b7a Merge pull request #495 from p-l-/fix-inet6addr
inet_{pton,ntop}: reorganize, cleanup and improve tests
2017-01-30 16:28:20 +01:00
Pierre Lalet d2f960092b Merge pull request #483 from guedou/codecov_5
[coverage] SCTP & DHCP tests
2017-01-29 15:17:02 +00:00
Pierre LALET 01110e502e inet_{pton,ntop}: reorganize, cleanup and improve tests 2017-01-29 16:04:12 +01:00
Guillaume Valadon 85d43059d0 Merge pull request #492 from hdnivara/pr/ipv4-addr-check
Error out incorrect IPv4 format in IPv6 addresses in inet_pton
2017-01-28 08:41:54 +01:00
Aravindhan Dhanasekaran 2e95845562 Unit tests for IPv6 addresses with inet_pton 2017-01-26 10:32:19 -08:00
Pierre LALET c1cc3bd600 ls(): fix tuple values display like "ls(IP(ttl=(1,10)))" 2017-01-25 19:27:46 +01:00
Pierre LALET f1b41e4213 Fix typo in tests 2017-01-25 18:48:30 +01:00
Pierre LALET 158350c279 Retry .whois() test on failure 2017-01-24 22:10:03 +01:00
plorinquer 2c9092a612 EAPOL-MKA (MACsec Key Agreement protocol) support. (#446) 2017-01-24 18:20:52 +00:00
Guillaume Valadon e4ed84e06e DHCP tests 2017-01-24 11:38:26 +01:00
Guillaume Valadon ee950aaa2a SCTP tests 2017-01-24 11:38:26 +01:00
ngkokkee e63ecd7bc4 Fix IA_PD length error (#428)
* Fix IA_PD length error

I tested this and noticed wireshark wasn't parsing the message correctly. Turns out the length is wrong.

* Update regression.uts

Fix test for DHCP6OptIA_PD

* Update length of DHCP6OptIA_PD in test.
2017-01-24 11:34:33 +01:00
Pierre LALET 17ec20bdca FlagValue: support multiple flags check at once
This PR makes it possible to check if several flags are all set, by
writting, for example, `if pkt[TCP].flags.SA:`.

It only works for single letter flags (e.g., will work for TCP().flags
but not for IP().flags), and only when getting a value.

Thanks @guedou for suggesting that.
2017-01-24 08:18:41 +01:00
Pierre LALET f0bfaf7501 Cleanup & test logical operations on flags 2017-01-24 08:18:41 +01:00
Pierre LALET c92fb3da1c Handle FlagValue fields changes with .raw_packet_cache 2017-01-24 08:18:41 +01:00
Pierre LALET 05841bb383 FlagValue objects are now mutable.
It is now possible to write `pkt[TCP].flags.S = True`.
2017-01-24 08:18:41 +01:00
Pierre LALET fc6a4caaf1 Introduce FlagValue(int) objects to represent FlagsField() values
This makes it possible to write `if pkt[TCP].flags.S: [...]`.
2017-01-24 08:18:41 +01:00
gpotter2 0c9b9089ab [coverage/Tiny fixes] Fixed some appveyor.yml tests (#481) 2017-01-22 15:51:46 +00:00
Guillaume Valadon 823bd4bdaf Unit tests fixed to test Route() methods on Windows 2017-01-21 10:59:25 +01:00
Guillaume Valadon b368c0d877 get_dummy_interface() added thanks to gpotter2 2017-01-21 10:59:25 +01:00
Guillaume Valadon 40686429e6 Fix in6_getLocalUniquePrefix() unit test 2017-01-21 10:59:25 +01:00
Guillaume Valadon 85e408d451 Fix CPython & pypy random outputs 2017-01-21 10:59:25 +01:00
Guillaume Valadon 5e7624b8ea get_if_raw_addr(): unified behavior 2017-01-21 10:59:25 +01:00
Guillaume Valadon 6e9b02642b More regression tests 2017-01-21 10:59:25 +01:00
Guillaume Valadon 932bd772f4 Typo 2017-01-21 10:59:25 +01:00
Pierre LALET 2664ff8802 Use SourceIPField in HSRPmd5 2017-01-20 09:08:32 +01:00
Pierre LALET 9ca0b3f7ec Fix SourceIPField() + add a couple of tests 2017-01-20 08:31:31 +01:00
Pierre Lalet 1b5c24df2c Merge pull request #464 from guedou/codecov_4
[coverage] VRRP, L2TP, HSRP, RIP, & Radius tests
2017-01-20 07:30:21 +00:00
Pierre Lalet d235d24ce2 Merge pull request #473 from gpotter2/fix-pickle
[coverage] main.py tests
2017-01-19 19:29:42 +00:00
Guillaume Valadon 8338dc3949 VRRP, L2TP, HSRP, RIP, & Radius tests 2017-01-19 09:26:35 +01:00
Benjamin fcb62e79a1 Fix issue #359: Bin to str conversion of IPv6 addresses (#431) 2017-01-18 18:51:23 +00:00
gpotter2 b3ef12b743 Add main.py tests 2017-01-17 22:37:30 +01:00
Pierre LALET 5069fcff0b Fix a bug in Source*Fields: p[layer].field != p.field
A new test that triggers the bug (with ARPSourceMACField) has been added.
2017-01-16 20:15:29 +01:00
Guillaume Valadon ad0bc43283 AS resolvers tests 2017-01-16 13:41:03 +01:00
gpotter2 18fe02f7e7 [Windows] Fix AutoCompletion + add tests (#465) 2017-01-15 17:32:00 +00:00
gpotter2 90da76f56b [Networking/Windows] Added IPv6 support (#398)
Fix IPv6 support on Windows
2017-01-13 07:25:04 +00:00
Guillaume Valadon fdb7380c4f Merge pull request #457 from plorinquer/eap-md5
EAP_MD5 class added.
2017-01-12 21:36:25 +01:00
Pierre LALET 0aa0633505 Fix empty LLTDAttribute build & dissect
- LLTDAttribute() produces a Raw instance (or crashes, when
    conf.debug_dissector is set).

  - str(LLTDAttribute(type=18)) crashes.
2017-01-11 17:38:51 +01:00
Pierre LALET 5fbdd49b1b New defrag() test 2017-01-11 16:39:51 +01:00
Pierre Lorinquer 7b458aecfe EAP_MD5 class added. 2017-01-11 14:03:54 +01:00
Pierre LALET 9e0e882ecc Add new IP-related tests 2017-01-11 12:54:10 +01:00
Pierre LALET be152458ce Adapt send_and_sniff() test function to work under Windows
Thanks @gpotter2
2017-01-09 21:45:37 +01:00
Pierre LALET 4da93c9a92 Add tests for sniff(), send(), sendp() 2017-01-09 21:12:47 +01:00
Pierre LALET b1b741c5f1 Tests: introduce "crypto" keyword
Pypy won't run crypto tests on Travis CI because the cryptography
module cannot be installed with the Pypy version used.
2017-01-06 13:56:05 +01:00
Pierre LALET 6957d3c89e Disable AES-CCM test
See
  - https://github.com/pyca/cryptography/issues/2968 (discussion)
  - https://github.com/pyca/cryptography/issues/1141 (older)
2017-01-06 13:56:05 +01:00
Thomas Faivre c24298b956 switch from PyCrypto to cryptography lib
Change the cryptographic library used in the following layers:
 * IPSec
 * TLS
 * Dot11

Notes:
 * Fix the WEP key in regression.uts: Should be a 40 bits key (5 ASCII)
   and 24 bits nonce for 64 bits WEP. The key was 8 ASCII => 88 bits
   in total
 * AES-GCM and AES-CMAC algorithms are now native in cryptography: add
   tests in ipsec.uts
 * cryptography only supports Python 2.6+
 * Fix the docstring for the pad method

Removed:
 * MD2 and MD4 hash algorithms for RSA in tls/crypto/pkcs1.py
 * AES-XCBC-96 not supported by cryptography.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2017-01-06 13:55:27 +01:00
Thomas Faivre 6928f05852 test/ipsec.uts: add ipsec tests to verify more combinaisons
Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2017-01-06 13:55:27 +01:00
Pierre LALET cdc4221662 Fix ls(): fix layer names and handle tuple default values (test added) 2017-01-04 23:47:31 +01:00
Guillaume Valadon 9dc5182d1f Merge pull request #423 from p-l-/enh-tcpdump
Introduce tcpdump() function
2017-01-04 10:04:55 +01:00
gpotter2 5daf27ed46 Fix misplaced quotes
I had not tested it last time... 
When running  `python`, the first parameter is the file. So here all the arguments were passed as the file name...
2016-12-29 17:11:17 +01:00
Pierre LALET 598bdae8c8 Introduce tcpdump() function
One can now use tcpdump or tshark to dissect packets from
Scapy. This can help, for example, to check Scapy's dissectors
2016-12-28 17:37:14 +01:00
Pierre LALET 5a7d25a85e Fix Windows bat files to work with spaces in paths (@gpotter2) 2016-12-26 23:36:25 +01:00
Piotr Bartosiewicz ab343d8994 Fix ipv4 fragment for already fragmented packets 2016-12-23 16:37:07 +01:00
Pierre LALET 9f2861fdbd Preserve .overloaded_fields in .clone_with()
This fixes at least an issue fragmentation (for which a new test
has been added)
2016-12-23 01:14:12 +01:00
Guillaume Valadon 3579d73657 Merge pull request #412 from p-l-/fix-tstamp
Improve Pcap & PcapNg support (particularly timestamps)
2016-12-22 13:07:06 +01:00
Pierre LALET 8c93b479d9 Add & test DNS over TCP, update dnstypes 2016-12-22 11:53:20 +01:00
Pierre LALET 15bf5f11d9 PcapNg: support nanosec precision, simple packet and obsolete packet blocks 2016-12-22 11:50:57 +01:00
Pierre LALET 2031000285 Support nanosec precision in Pcap + fix TS in PcapNg 2016-12-21 18:52:41 +01:00
Pierre LALET 2725e5a6ba Fix & test MIP6MH_HoT.answers() 2016-12-21 12:56:58 +01:00
Pierre LALET 300e96a7c5 Fix & test Route6.ifchange() 2016-12-21 12:56:18 +01:00
Pierre Lalet db7c72f041 Add conf.checkIPinIP (#387)
* Add conf.checkIPinIP

This setting, when set to False, will exclude IP layers which encapsulate
another IP layer from the checks to tell if a packet is an answer to
another one.

Fixes #383

* conf.checkIPinIP affects both IP() and IPv6()

Setting conf.checkIPinIP will handle IP()/IP(), IP()/IPv6(),
IPv6()/IP(), IPv6()/IPv6().

Thanks @guedou!

* Clean-up IP.hashret and .answers code

* Add tests for .hashret() and .answers()
2016-12-20 09:08:57 +01:00
Pierre Lalet 7ec0af2c09 Support (BPF) filter in sniff() with offline parameter set (#394)
* Support (BPF) filter in sniff() with offline parameter set

Fixes #393
Also, fixes #355

* Add tests for wrpcap() and sniff(offline=)

as suggested by Guillaume.

Also, cleanup regression.uts since it was a pain to find a place
to add those tests.

* Fix PATH for tcpdump with non-root user

* Do not run tcpdump tests when tcpdump is not available

* Appveyor tests: install WinDump.exe

Thanks @gpotter2
2016-12-20 07:46:27 +01:00
Pierre Lalet 45c59302ce Merge pull request #329 from guedou/BB_copy_flag
Fixed the invalid copy_flag in some ip options
2016-12-16 00:45:41 +00:00
Pierre Lalet e30c0525f0 Merge pull request #388 from X-Cli/http2
HTTP/2 support
2016-12-16 00:43:47 +00:00
Guillaume Valadon 58fdc06cd1 AppVeyor support 2016-12-15 08:03:41 +01:00
Florian Maury 0c892a5b12 Add MultiFlagsField 2016-12-14 13:48:24 +01:00
Guillaume Valadon 35f97efc53 Native Mac OS X and *BSD support (#221) 2016-12-02 07:07:09 +00:00
Guillaume Valadon 35145f8c87 Fixed the invalid copy_flag in some ip options
- original patch from Yitai Schwartz, https://bitbucket.org/secdev/scapy/pull-requests/62/
2016-11-03 14:44:03 +01:00
Florian Maury bf1c3ee866 Add SSLStreamSocket 2016-10-26 17:53:20 +02:00
Daniel Collins 620f195c65 Corrected ICV length for AES-GCM and AES-CCM in IPSec layer. Added un… (#269)
* Corrected ICV length for AES-GCM and AES-CCM in IPSec layer. Added unit tests to the ipsec campaign.

* Added travis support for pycrypto 2.7a1 combined modes.

* Updated documentation for pycrypto installation.
2016-10-26 10:03:37 +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
Guillaume Valadon 8a817801a7 Merge pull request #282 from alegacy/master
vxlan: fixed incorrect field layout specification
2016-08-31 14:03:52 +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
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 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
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
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
plorinquer 1e48e13fc5 NTP module update 2016-08-01 16:48:01 +02:00
Martijn Thé 2c28f06d82 Bluetooth: Add LE Connection Update command & event types (#234) 2016-07-30 15:47:42 +02:00
Pierre Lorinquer 64e98a35f1 regression.uts: assert() statements added to the EAPOL / EAP class tests to make them fail. 2016-07-22 13:13:32 +02:00
mtury 4faaaac043 cert.py improvements (#175)
cert.py improvements

* Improve cert.py : independence from openssl, ECDSA support, sign/verify capabilities

* Make travis install python-ecdsa

* Clarify ECDSA support

* Cleaning up for cert.py
2016-07-20 14:17:12 +02:00