Test TLS automta with tox

This commit is contained in:
Guillaume Valadon 2018-04-24 09:17:45 +02:00
parent dbe409531a
commit ca791331b4
3 changed files with 21 additions and 15 deletions

View File

@ -3,6 +3,7 @@ concurrency = multiprocessing
omit =
# Scapy specific paths
scapy/tools/UTscapy.py
test/*
# Scapy external modules
scapy/modules/six.py
scapy/modules/winpcapy.py

View File

@ -1,7 +1,8 @@
{
"testfiles": [
"test/*.uts",
"scapy/contrib/*.uts"
"scapy/contrib/*.uts",
"test/tls/tests_tls_netaccess.uts"
],
"remove_testfiles": [
"test/mock_windows.uts",

View File

@ -9,13 +9,15 @@
### DISCLAIMER: Those tests are slow ###
= Load server util functions
~ open_ssl_client crypto
~ open_ssl_client crypto needs_root
from __future__ import print_function
import sys, os, re, time, multiprocessing, subprocess
sys.path.append(os.path.abspath("./tls"))
dirname = "/test/tls/"
dirname = os.getenv("SCAPY_ROOT_DIR")+dirname if not os.path.exists(dirname) else dirname
sys.path.append(os.path.abspath(dirname))
from travis_test_server import *
@ -29,7 +31,9 @@ def test_tls_server(suite="", version=""):
q_.get()
time.sleep(1)
# Run client
CA_f = os.path.abspath("./tls/pki/ca_cert.pem")
filename = "/test/tls/pki/ca_cert.pem"
filename = os.getenv("SCAPY_ROOT_DIR")+filename if not os.path.exists(filename) else filename
CA_f = os.path.abspath(filename)
p = subprocess.Popen(
["openssl", "s_client", "-debug", "-cipher", suite, version, "-CAfile", CA_f],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
@ -64,29 +68,29 @@ def test_tls_server(suite="", version=""):
= Testing TLS server with TLS 1.0 and TLS_RSA_WITH_RC4_128_SHA
~ open_ssl_client crypto
~ open_ssl_client crypto needs_root
test_tls_server("RC4-SHA", "-tls1")
= Testing TLS server with TLS 1.1 and TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
~ open_ssl_client crypto
~ open_ssl_client crypto needs_root
test_tls_server("EDH-RSA-DES-CBC3-SHA", "-tls1_1")
= Testing TLS server with TLS 1.2 and TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
~ open_ssl_client crypto
~ open_ssl_client crypto needs_root
test_tls_server("DHE-RSA-AES128-SHA256", "-tls1_2")
= Testing TLS server with TLS 1.2 and TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
~ open_ssl_client crypto
~ open_ssl_client crypto needs_root
test_tls_server("ECDHE-RSA-AES256-GCM-SHA384", "-tls1_2")
+ TLS client automaton tests
= Load client utils functions
~ crypto
~ crypto needs_root
import sys, os, threading
@ -113,32 +117,32 @@ def perform_tls_client_test(suite, version):
assert False
= Testing TLS server and client with SSLv2 and SSL_CK_DES_192_EDE3_CBC_WITH_MD5
~ crypto
~ crypto needs_root
perform_tls_client_test("0700c0", "0002")
= Testing TLS client with SSLv3 and TLS_RSA_EXPORT_WITH_RC4_40_MD5
~ crypto
~ crypto needs_root
perform_tls_client_test("0003", "0300")
= Testing TLS client with TLS 1.0 and TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
~ crypto
~ crypto needs_root
perform_tls_client_test("0088", "0301")
= Testing TLS client with TLS 1.1 and TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
~ crypto
~ crypto needs_root
perform_tls_client_test("c013", "0302")
= Testing TLS client with TLS 1.2 and TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
~ crypto
~ crypto needs_root
perform_tls_client_test("009e", "0303")
= Testing TLS client with TLS 1.2 and TLS_ECDH_anon_WITH_RC4_128_SHA
~ crypto
~ crypto needs_root
perform_tls_client_test("c016", "0303")