[Python-modules-commits] [ripe-atlas-sagan] 04/06: Import ripe-atlas-sagan_1.1.10.orig.tar.gz
Apollon Oikonomopoulos
apoikos at moszumanska.debian.org
Fri Mar 11 11:30:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
apoikos pushed a commit to branch master
in repository ripe-atlas-sagan.
commit 58e94dd6b0b361b09e2d46446c84f3a2c3419fe4
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date: Wed Mar 9 18:57:14 2016 +0200
Import ripe-atlas-sagan_1.1.10.orig.tar.gz
---
CHANGES.rst | 7 +-
README.rst | 2 -
docs/installation.rst | 2 -
docs/types.rst | 10 +-
docs/use.rst | 4 +-
ripe/__init__.py | 2 +-
ripe/atlas/__init__.py | 2 +-
ripe/atlas/sagan/__init__.py | 2 +-
ripe/atlas/sagan/base.py | 7 +-
ripe/atlas/sagan/dns.py | 2 +-
ripe/atlas/sagan/helpers/__init__.py | 2 +-
ripe/atlas/sagan/helpers/abuf.py | 2 +-
ripe/atlas/sagan/helpers/compatibility.py | 2 +-
ripe/atlas/sagan/http.py | 2 +-
ripe/atlas/sagan/ntp.py | 2 +-
ripe/atlas/sagan/ping.py | 2 +-
ripe/atlas/sagan/ssl.py | 60 +++++++++++-
ripe/atlas/sagan/traceroute.py | 56 ++++++-----
ripe/atlas/sagan/version.py | 4 +-
scripts/parse_abuf | 150 ------------------------------
setup.py | 4 -
tests/ssl.py | 32 +++++++
22 files changed, 154 insertions(+), 204 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index b35b6c9..942d843 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,11 @@
Changelog
=========
-
+* 1.1.10
+ * Added a `parse_all_hops` kwarg to the Traceroute class to tell Sagan to stop parsing Hops and Packets once we have all of the last hop statistics (default=True)
+ * Remove dependency on IPy: we were using it for IPv6 canonicalization, but all IPv6 addresses in results should be in canonical form to start with.
+* 1.1.9
+ * Removed the `parse_abuf` script because no one was using it and its
+ Python3 support was suspect anyway.
* 1.1.8
* Handle case where a traceroute result might not have ``dst_addr`` field.
* 1.1.7
diff --git a/README.rst b/README.rst
index c6e170a..fa2dfb4 100644
--- a/README.rst
+++ b/README.rst
@@ -178,7 +178,6 @@ are a few dependencies:
- `pyOpenSSL`_ (Optional: see "Troubleshooting" above)
- `python-dateutil`_
- `pytz`_
-- `IPy`_
Additionally, we recommend that you also install `ujson`_ as it will speed up
the JSON-decoding step considerably, and `sphinx`_ if you intend to build the
@@ -233,7 +232,6 @@ decades reaching out to the public about the wonders of the cosmos?
.. _pyOpenSSL: https://pypi.python.org/pypi/pyOpenSSL
.. _python-dateutil: https://pypi.python.org/pypi/python-dateutil
.. _pytz: https://pypi.python.org/pypi/pytz
-.. _IPy: https://pypi.python.org/pypi/IPy/
.. _ujson: https://pypi.python.org/pypi/ujson
.. _sphinx: https://pypi.python.org/pypi/Sphinx
.. _Read the Docs: http://ripe-atlas-sagan.readthedocs.org/en/latest/
diff --git a/docs/installation.rst b/docs/installation.rst
index 32363ff..42d4f6a 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -14,7 +14,6 @@ are a few dependencies:
* `pyOpenSSL`_
* `python-dateutil`_
* `pytz`_
-* `IPy`_
Additionally, we recommend that you also install `ujson`_ as it will speed up
the JSON-decoding step considerably, and `sphinx`_ if you intend to build the
@@ -23,7 +22,6 @@ documentation files for offline use.
.. _pyOpenSSL: https://pypi.python.org/pypi/pyOpenSSL/
.. _python-dateutil: https://pypi.python.org/pypi/python-dateutil/
.. _pytz: https://pypi.python.org/pypi/pytz/
-.. _IPy: https://pypi.python.org/pypi/IPy/
.. _ujson: https://pypi.python.org/pypi/ujson/
.. _sphinx: https://pypi.python.org/pypi/Sphinx/
diff --git a/docs/types.rst b/docs/types.rst
index eb0ee9d..c3e16bd 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -93,7 +93,7 @@ end_time_timestamp int A Unix timestamp for the ``end_time`` attrib
paris_id int
size int The packet size
protocol str One of ``ICMP``, ``TCP``, ``UDP``
-hops list A list of :ref:`traceroute-hop` objects
+hops list A list of :ref:`traceroute-hop` objects. If the ``parse_all_hops`` parameter is ``False``, this will only contain the last hop.
total_hops int The total number of hops
ip_path list A list of dicts containing the IPs at each hop. This is just for convenience as all of these values are accessible via the :ref:`traceroute-hop` and :ref:`traceroute-packet` objects.
last_median_rtt float The median value of all RTTs from the last successful hop
@@ -103,6 +103,14 @@ is_success bool Set to ``True`` if the traceroute finished s
last_hop_errors list A list of last hop's errors
======================== ======== ===================================================================================
+It is also possible to supply the following parameter to control parsing of Traceroute results:
+
+============== ==== ======= ===========
+Parameter Type Default Explanation
+============== ==== ======= ===========
+parse_all_hops bool True Set to ``False`` to stop parsing ``Hop`` objects after the ``last_*`` properties (see above) have been set. This will cause ``hops`` to only contain the last ``Hop``.
+============== ==== ======= ===========
+
.. _traceroute-hop:
diff --git a/docs/use.rst b/docs/use.rst
index d7d4482..b4f0d1e 100644
--- a/docs/use.rst
+++ b/docs/use.rst
@@ -83,9 +83,9 @@ There may be a case where you have code that's just expected to parse a result
string, without knowing ahead of time what type of result it is. For this we
make use of the parent ``Result`` class' ``get()`` method::
- from ripe.atlas.sagan import PingResult
+ from ripe.atlas.sagan import Result
- my_result = PingResult('this is where your big JSON blob goes')
+ my_result = Result.get('this is where your big JSON blob goes')
my_result.af
# Returns 6
diff --git a/ripe/__init__.py b/ripe/__init__.py
index 552b781..67dfd40 100644
--- a/ripe/__init__.py
+++ b/ripe/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/__init__.py b/ripe/atlas/__init__.py
index 552b781..67dfd40 100644
--- a/ripe/atlas/__init__.py
+++ b/ripe/atlas/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/__init__.py b/ripe/atlas/sagan/__init__.py
index 18220f5..f313a28 100644
--- a/ripe/atlas/sagan/__init__.py
+++ b/ripe/atlas/sagan/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/base.py b/ripe/atlas/sagan/base.py
index 2fc6f39..cb141ef 100644
--- a/ripe/atlas/sagan/base.py
+++ b/ripe/atlas/sagan/base.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,6 +89,11 @@ class ParsingDict(object):
self._on_malformation = kwargs.pop("on_malformation", self.ACTION_WARN)
self.is_malformed = False
+ def __nonzero__(self):
+ # If we don't define this, Python ends up calling keys()
+ # via __len__() whenever we evaluate the object as a bool.
+ return True
+
def __len__(self):
return len(self.keys())
diff --git a/ripe/atlas/sagan/dns.py b/ripe/atlas/sagan/dns.py
index b64ee19..13920b0 100644
--- a/ripe/atlas/sagan/dns.py
+++ b/ripe/atlas/sagan/dns.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/helpers/__init__.py b/ripe/atlas/sagan/helpers/__init__.py
index 394a298..e82b80d 100644
--- a/ripe/atlas/sagan/helpers/__init__.py
+++ b/ripe/atlas/sagan/helpers/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/helpers/abuf.py b/ripe/atlas/sagan/helpers/abuf.py
index 2dedb77..0bea6c0 100644
--- a/ripe/atlas/sagan/helpers/abuf.py
+++ b/ripe/atlas/sagan/helpers/abuf.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/helpers/compatibility.py b/ripe/atlas/sagan/helpers/compatibility.py
index 3f20154..72aacc2 100644
--- a/ripe/atlas/sagan/helpers/compatibility.py
+++ b/ripe/atlas/sagan/helpers/compatibility.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/http.py b/ripe/atlas/sagan/http.py
index c5e483e..aaae8e5 100644
--- a/ripe/atlas/sagan/http.py
+++ b/ripe/atlas/sagan/http.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/ntp.py b/ripe/atlas/sagan/ntp.py
index bbc5abc..00dc75d 100644
--- a/ripe/atlas/sagan/ntp.py
+++ b/ripe/atlas/sagan/ntp.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/ping.py b/ripe/atlas/sagan/ping.py
index 018f040..c6bf099 100644
--- a/ripe/atlas/sagan/ping.py
+++ b/ripe/atlas/sagan/ping.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ripe/atlas/sagan/ssl.py b/ripe/atlas/sagan/ssl.py
index d8134dc..44ea8cc 100644
--- a/ripe/atlas/sagan/ssl.py
+++ b/ripe/atlas/sagan/ssl.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -180,6 +180,53 @@ class Certificate(ParsingDict):
return dictionary[key].decode("UTF-8")
+class Alert(ParsingDict):
+
+ # Taken from https://tools.ietf.org/html/rfc5246#section-7.2
+ DESCRIPTION_MAP = {
+ 0: "close_notify",
+ 10: "unexpected_message",
+ 20: "bad_record_mac",
+ 21: "decryption_failed_RESERVED",
+ 22: "record_overflow",
+ 30: "decompression_failure",
+ 40: "handshake_failure",
+ 41: "no_certificate_RESERVED",
+ 42: "bad_certificate",
+ 43: "unsupported_certificate",
+ 44: "certificate_revoked",
+ 45: "certificate_expired",
+ 46: "certificate_unknown",
+ 47: "illegal_parameter",
+ 48: "unknown_ca",
+ 49: "access_denied",
+ 50: "decode_error",
+ 51: "decrypt_error",
+ 60: "export_restriction_RESERVED",
+ 70: "protocol_version",
+ 71: "insufficient_security",
+ 80: "internal_error",
+ 90: "user_canceled",
+ 100: "no_renegotiation",
+ 110: "unsupported_extension",
+ }
+
+ def __init__(self, data, **kwargs):
+
+ ParsingDict.__init__(self, **kwargs)
+
+ self.raw_data = data
+
+ self.level = self.ensure("level", int)
+ self.description = self.ensure("decription", int)
+ if self.description is None:
+ self.description = self.ensure("description", int)
+
+ @property
+ def description_string(self):
+ return self.DESCRIPTION_MAP.get(self.description, "Unknown")
+
+
class SslResult(Result):
def __init__(self, data, **kwargs):
@@ -196,13 +243,18 @@ class SslResult(Result):
self.response_time = self.ensure("rt", float)
self.time_to_connect = self.ensure("ttc", float)
- self.certificates = []
- self.is_self_signed = False
-
# Older versions used named ports
if self.port is None and self.raw_data.get("dst_port") == "https":
self.port = 443
+ self.alert = None
+ self.certificates = []
+ self.is_self_signed = False
+
+ if "alert" in self.raw_data:
+ self.alert = Alert(self.raw_data["alert"], **kwargs)
+ self._handle_error(self.alert.description_string)
+
if "cert" in self.raw_data and isinstance(self.raw_data["cert"], list):
for certificate in self.raw_data["cert"]:
diff --git a/ripe/atlas/sagan/traceroute.py b/ripe/atlas/sagan/traceroute.py
index 41d5989..b8fa419 100644
--- a/ripe/atlas/sagan/traceroute.py
+++ b/ripe/atlas/sagan/traceroute.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@
import logging
from calendar import timegm
-from IPy import IP
from .base import Result, ParsingDict
@@ -102,16 +101,15 @@ class Hop(ParsingDict):
self._handle_error(error)
self.packets = []
+ packet_rtts = []
if "result" in self.raw_data:
- for packet in self.raw_data["result"]:
- if "late" not in packet:
- self.packets.append(Packet(packet, **kwargs))
-
- self.median_rtt = None
- if self.packets:
- rtts = sorted([p.rtt for p in self.packets if p and p.rtt])
- if rtts:
- self.median_rtt = Result.calculate_median(rtts)
+ for raw_packet in self.raw_data["result"]:
+ if "late" not in raw_packet:
+ packet = Packet(raw_packet, **kwargs)
+ if packet.rtt:
+ packet_rtts.append(packet.rtt)
+ self.packets.append(packet)
+ self.median_rtt = Result.calculate_median(packet_rtts)
def __str__(self):
return self.index
@@ -168,9 +166,9 @@ class TracerouteResult(Result):
if not self.destination_address:
return
- destination_address = IP(self.destination_address)
for packet in last_hop.packets:
- if packet.origin and destination_address == IP(packet.origin):
+ if packet.origin and \
+ self.destination_address == packet.origin:
self.destination_ip_responded = True
break
@@ -214,7 +212,7 @@ class TracerouteResult(Result):
r.append([packet.origin for packet in hop.packets])
return r
- def _parse_hops(self, **kwargs):
+ def _parse_hops(self, parse_all_hops=True, **kwargs):
try:
hops = self.raw_data["result"]
@@ -223,22 +221,30 @@ class TracerouteResult(Result):
self._handle_malformation("Legacy formats not supported")
return
- hops_number = len(hops)
- for index, hop in enumerate(hops):
-
- hop = Hop(hop, **kwargs)
-
- if hop.median_rtt:
- self.last_median_rtt = hop.median_rtt
+ num_hops = len(hops)
+ # Go through the hops in reverse so that if
+ # parse_all_hops is False we can stop processing as
+ # soon as possible.
+ for index, raw_hop in reversed(list(enumerate(hops))):
- self.hops.append(hop)
- self.total_hops += 1
+ hop = Hop(raw_hop, **kwargs)
- # If last hop set several usefull properties
- if index + 1 == hops_number:
+ # If last hop set several useful attributes
+ if index + 1 == num_hops:
self.set_destination_ip_responded(hop)
self.set_last_hop_responded(hop)
self.set_is_success(hop)
+ # We always store the last hop
+ self.hops.insert(0, hop)
+ elif parse_all_hops:
+ self.hops.insert(0, hop)
+
+ if hop.median_rtt and not self.last_median_rtt:
+ self.last_median_rtt = hop.median_rtt
+ if not parse_all_hops:
+ # Now that we have the last RTT we can stop
+ break
+ self.total_hops = num_hops
__all__ = (
diff --git a/ripe/atlas/sagan/version.py b/ripe/atlas/sagan/version.py
index b2903cf..2bcfe10 100644
--- a/ripe/atlas/sagan/version.py
+++ b/ripe/atlas/sagan/version.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 RIPE NCC
+# Copyright (c) 2016 RIPE NCC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__version__ = "1.1.8"
+__version__ = "1.1.10"
diff --git a/scripts/parse_abuf b/scripts/parse_abuf
deleted file mode 100755
index 84b479f..0000000
--- a/scripts/parse_abuf
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import base64
-import json
-import string
-import sys
-
-from ripe.atlas.sagan.helpers.abuf import AbufParser
-
-def main(args):
-
- options = args.__dict__
-
- result = {
- 'line_count': 0,
- 'decodedabufs_with_ERROR': 0,
- 'abufdecode_failures': 0,
- 'b64decode_failures': 0
- }
-
- line = sys.stdin.readline()
-
- if args.verbosity > 2:
- print "#inputline:\n#", line, "#end inputline-----"
-
- if line[:1] == "{" and line[-2:-1] == "}":
-
- # json encoded data (RIPE Atlas measurment)
- while line:
-
- if args.verbosity >1:
- print "#json line:\n# ", line, "#end json line-----"
-
- result['line_count'] += 1
- result['errorFindingDecodingabuf'] = 0
- data = None
-
- try:
-
- data = json.loads(line)
- if data.has_key('result'):
- if data['result'].has_key('abuf'):
- babuf = None
- if args.verbosity >1:
- print "#b64buf:\n#",data['result']['abuf'],"\n#end b64buf------"
- try:
- babuf = base64.b64decode(data['result']['abuf'])
- except Exception:
- result['b64decode_failures'] += 1;
-
- if babuf:
- adata = AbufParser.parse(babuf, options) #, result)
- if adata:
- if data.has_key('ERROR'):
- result['decodedabufs_with_ERROR'] += 1
- data['DnsReply']= adata
-
- except Exception:
-
- line = sys.stdin.readline()
- continue
- error = []
- e = ("Error finding/decoding abuf")
- error.append(e)
- print "error:", error
- data['ERROR'] = error
- result['errorFindingDecodingabuf'] += 1
-
- if args.formattedJSON:
- print json.dumps(
- data,
- sort_keys=True,
- indent=4,
- separators=(',', ': ')
- )
- else:
- print json.dumps(data)
-
- line = sys.stdin.readline()
-
- else: # Plain b64 encoced abuf
-
- while line:
- if args.verbosity > 1:
- print "#b64 encoded abuf line:\n#", line, "#end b64 encoded abuf line-----"
- result['line_count'] += 1
-
- try:
- babuf = base64.b64decode(line)
- except Exception:
- result['b64decode_failures'] += 1;
- line = sys.stdin.readline()
- continue
-
- data = AbufParser.parse(babuf, options)
-
- if data:
- if data.has_key('ERROR'):
- result['decodedabufs_with_ERROR'] += 1
- if args.formattedJSON:
- print json.dumps(
- data,
- sort_keys=True,
- indent=4,
- separators=(',', ': ')
- )
- else:
- print json.dumps(data)
- else:
- result['abufdecode_failures'] += 1
-
- line = sys.stdin.readline()
-
- if args.verbosity:
- print "#======== results:\n#",
- lines = json.dumps(
- result,
- sort_keys=True,
- indent=4,
- separators=(',', ': ')
- )
- print string.replace(lines, "\n", "\n#") # We want this to be comments lines on stdout
-
- sys.stdout.flush()
-
-
-if __name__ == '__main__':
-
- parser = argparse.ArgumentParser()
- parser.add_argument('-v', '--verbosity', default=0, action="count")
- parser.add_argument('-fj', '--formattedJSON', default=0, action="count")
- parser.add_argument('-dh', '--DO_Header', default=0, action="count")
- parser.add_argument('-dq', '--DO_Question', default=0, action="count")
- parser.add_argument('-dan', '--DO_Answer', default=0, action="count")
- parser.add_argument('-dad', '--DO_Additional', default=0, action="count")
- parser.add_argument('-dau', '--DO_Authority', default=0, action="count")
- parser.add_argument('-do', '--DO_Options', default=0, action="count")
- parser.add_argument('-dall', '--DO_All', default=0, action="count")
- args = parser.parse_args()
-
- if args.DO_All:
- args.DO_Header = 1
- args.DO_Question = 1
- args.DO_Answer = 1
- args.DO_Additional = 1
- args.DO_Authority = 1
- args.DO_Options = 1
-
- sys.exit(main(args))
diff --git a/setup.py b/setup.py
index f6b5123..1386080 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,6 @@ name = "ripe.atlas.sagan"
install_requires = [
"python-dateutil",
"pytz",
- "IPy",
]
tests_require = ["nose"]
@@ -51,9 +50,6 @@ with open(readme_path) as readme:
"doc": ["sphinx"]
},
test_suite="nose.collector",
- scripts=[
- "scripts/parse_abuf"
- ],
classifiers=[
"Operating System :: POSIX",
"Operating System :: Unix",
diff --git a/tests/ssl.py b/tests/ssl.py
index c8f3b8b..57b8dbb 100644
--- a/tests/ssl.py
+++ b/tests/ssl.py
@@ -16,6 +16,7 @@
from ripe.atlas.sagan import Result, ResultError
from ripe.atlas.sagan.ssl import SslResult
+
def test_ssl_4480():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIFBTCCAu2gAwIBAgIDDLHHMA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDEwNjE0MDA1NVoXDTEzMDcwNTE0MDA1NVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -49,6 +50,7 @@ def test_ssl_4480():
assert(result.certificates[0].checksum_sha1 == "11:00:27:07:F7:E8:0C:6B:5F:B6:A3:5A:20:19:BC:CA:22:85:E5:3C")
assert(result.certificates[0].checksum_sha256 == "AC:D1:6F:FB:3A:F2:06:C9:92:A4:4D:2A:A2:0B:1C:37:35:25:75:A7:5D:4A:62:21:03:AD:E6:46:42:E5:65:4C")
+
def test_ssl_4500():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIFBTCCAu2gAwIBAgIDDLHHMA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDEwNjE0MDA1NVoXDTEzMDcwNTE0MDA1NVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -82,6 +84,7 @@ def test_ssl_4500():
assert(result.certificates[0].checksum_sha1 == "11:00:27:07:F7:E8:0C:6B:5F:B6:A3:5A:20:19:BC:CA:22:85:E5:3C")
assert(result.certificates[0].checksum_sha256 == "AC:D1:6F:FB:3A:F2:06:C9:92:A4:4D:2A:A2:0B:1C:37:35:25:75:A7:5D:4A:62:21:03:AD:E6:46:42:E5:65:4C")
+
def test_ssl_4520():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDXW/MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDcwNjA1NTQ1NFoXDTE0MDEwMjA1NTQ1NFowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -115,6 +118,7 @@ def test_ssl_4520():
assert(result.certificates[0].checksum_sha1 == "C5:31:2B:AC:B2:4F:D2:F8:47:57:2A:4F:04:D7:F9:18:91:20:C7:1F")
assert(result.certificates[0].checksum_sha256 == "F9:C1:DC:CE:CE:C2:E8:42:00:D1:A1:B5:0D:93:09:DE:73:DA:CE:56:0A:FD:A3:BB:B1:CC:1E:2E:47:15:C3:A6")
+
def test_ssl_4540():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDXW/MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDcwNjA1NTQ1NFoXDTE0MDEwMjA1NTQ1NFowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -148,6 +152,7 @@ def test_ssl_4540():
assert(result.certificates[0].checksum_sha1 == "C5:31:2B:AC:B2:4F:D2:F8:47:57:2A:4F:04:D7:F9:18:91:20:C7:1F")
assert(result.certificates[0].checksum_sha256 == "F9:C1:DC:CE:CE:C2:E8:42:00:D1:A1:B5:0D:93:09:DE:73:DA:CE:56:0A:FD:A3:BB:B1:CC:1E:2E:47:15:C3:A6")
+
def test_ssl_4550():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDXW/MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDcwNjA1NTQ1NFoXDTE0MDEwMjA1NTQ1NFowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -181,6 +186,7 @@ def test_ssl_4550():
assert(result.certificates[0].checksum_sha1 == "C5:31:2B:AC:B2:4F:D2:F8:47:57:2A:4F:04:D7:F9:18:91:20:C7:1F")
assert(result.certificates[0].checksum_sha256 == "F9:C1:DC:CE:CE:C2:E8:42:00:D1:A1:B5:0D:93:09:DE:73:DA:CE:56:0A:FD:A3:BB:B1:CC:1E:2E:47:15:C3:A6")
+
def test_ssl_4550_error():
result_string = '{"dnserr":"non-recoverable failure in name resolution","dst_name":"pretical.ee","dst_port":"443","from":"77.95.64.18","fw":4550,"msm_id":1006864,"msm_name":"SSLCert","prb_id":517,"timestamp":1380791230,"type":"sslcert"}'
result = Result.get(result_string)
@@ -242,6 +248,7 @@ def test_ssl_4560():
assert(result.certificates[0].checksum_sha1 == "C5:31:2B:AC:B2:4F:D2:F8:47:57:2A:4F:04:D7:F9:18:91:20:C7:1F")
assert(result.certificates[0].checksum_sha256 == "F9:C1:DC:CE:CE:C2:E8:42:00:D1:A1:B5:0D:93:09:DE:73:DA:CE:56:0A:FD:A3:BB:B1:CC:1E:2E:47:15:C3:A6")
+
def test_ssl_4570():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDky9MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTE0MDEwMzIxMjI1MVoXDTE0MDcwMjIxMjI1MVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -275,6 +282,7 @@ def test_ssl_4570():
assert(result.certificates[0].checksum_sha1 == "2B:FE:E8:F8:4B:25:19:D4:9B:3B:18:A3:29:E1:6C:79:72:FF:96:02")
assert(result.certificates[0].checksum_sha256 == "28:E6:A2:51:CE:D1:E9:34:2E:69:41:44:55:43:41:88:4D:93:4E:67:02:09:48:8C:86:68:25:8F:5E:DF:96:98")
+
def test_ssl_4600():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDky9MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTE0MDEwMzIxMjI1MVoXDTE0MDcwMjIxMjI1MVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -308,6 +316,7 @@ def test_ssl_4600():
assert(result.certificates[0].checksum_sha1 == "2B:FE:E8:F8:4B:25:19:D4:9B:3B:18:A3:29:E1:6C:79:72:FF:96:02")
assert(result.certificates[0].checksum_sha256 == "28:E6:A2:51:CE:D1:E9:34:2E:69:41:44:55:43:41:88:4D:93:4E:67:02:09:48:8C:86:68:25:8F:5E:DF:96:98")
+
def test_ssl_4610():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIEzjCCAragAwIBAgIDDky9MA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTE0MDEwMzIxMjI1MVoXDTE0MDcwMjIxMjI1MVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
assert(isinstance(result, SslResult))
@@ -341,16 +350,39 @@ def test_ssl_4610():
assert(result.certificates[0].checksum_sha1 == "2B:FE:E8:F8:4B:25:19:D4:9B:3B:18:A3:29:E1:6C:79:72:FF:96:02")
assert(result.certificates[0].checksum_sha256 == "28:E6:A2:51:CE:D1:E9:34:2E:69:41:44:55:43:41:88:4D:93:4E:67:02:09:48:8C:86:68:25:8F:5E:DF:96:98")
+
def test_ssl_lts():
result = Result.get('{"lts":143,"rt":149.405,"from":"94.214.66.164","dst_name":"pretical.ee","af":4,"timestamp":1406561035,"msm_name":"SSLCert","fw":4650,"prb_id":7,"method":"SSL","cert":["-----BEGIN CERTIFICATE-----\\nMIIFBTCCAu2gAwIBAgIDDzuhMA0GCSqGSIb3DQEBCwUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTE0MDcwMzE5MDczMVoXDTE0MTIzMDE5MDczMVowGDEW\\nM [...]
assert(result.seconds_since_sync == 143)
+
def test_self_signed():
ca_signed = Result.get('{"lts":663,"rt":27.807,"from":"2001:67c:2e8:13:220:4aff:fec6:cc6e","dst_name":"2a00:1450:4005:809::1010","af":6,"timestamp":1410867341,"msm_name":"SSLCert","fw":4660,"prb_id":15,"method":"SSL","cert":["-----BEGIN CERTIFICATE-----\\nMIIEdjCCA16gAwIBAgIIcPRu2ubZ1kMwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE\\nBhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl\\ncm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwODI3MTE0MDU1WhcNMTQxMTI1MDAwMDAw\\nWjBoMQswCQYDVQQGEwJVUzETMBEGA1U [...]
self_signed = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIDEDCCAfgCCQCKlfFLvltvwjANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJI\\nVTEaMBgGA1UEAwwRa2FkYXJrYS5raXN0ZWwuaHUxHzAdBgkqhkiG9w0BCQEWEGtp\\nc3RlbEBraXN0ZWwuaHUwHhcNMTIxMDA0MDg1NTAzWhcNMjIxMDAyMDg1NTAzWjBK\\nMQswCQYDVQQGEwJIVTEaMBgGA1UEAwwRa2FkYXJrYS5raXN0ZWwuaHUxHzAdBgkq\\nhkiG9w0BCQEWEGtpc3RlbEBraXN0ZWwuaHUwggEiMA0GCSqGSIb3DQEBAQUAA4IB\\nDwAwggEKAoIBAQC7rhzio/gldiYiNjAANOgE6s1fns6BQ+yWvwXdEwm05+xwf+iD\\nP4LDzMrjsWDwy [...]
assert(ca_signed.is_self_signed == False)
assert(self_signed.is_self_signed == True)
+
def test_non_ascii():
result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\nMIIGRTCCBS2gAwIBAgIRANOWS9WhQ5qPpLm5lNqj+s8wDQYJKoZIhvcNAQELBQAw\ngc0xCzAJBgNVBAYTAlJVMQ8wDQYDVQQIEwZNb3Njb3cxDzANBgNVBAcTBk1vc2Nv\ndzFrMGkGA1UECgxiUlUtQ2VudGVyICjQl9CQ0J4g0KDQtdCz0LjQvtC90LDQu9GM\n0L3Ri9C5INCh0LXRgtC10LLQvtC5INCY0L3RhNC+0YDQvNCw0YbQuNC+0L3QvdGL\n0Lkg0KbQtdC90YLRgCkxLzAtBgNVBAMTJlJVLUNFTlRFUiBIaWdoIEFzc3VyYW5j\nZSBTZXJ2aWNlcyBDQSAyMB4XDTE1MDMyNjAwMDAwMFoXDTE3MDQwNjIzNTk1OVow\nggEiMQswCQYDVQQGEwJSVTEPM [...]
assert(isinstance(result, SslResult))
+
+
+def test_alert():
+ result = Result.get('{"lts":60,"rt":65.88887,"from":"134.197.42.163","dst_name":"aus5.mozilla.org","af":4,"timestamp":1452783251,"msm_name":"SSLCert","fw":4720,"alert":{"decription":40,"level":2},"method":"TLS","prb_id":10008,"dst_port":"443","ttc":31.621485,"src_addr":"134.197.42.163","group_id":3322890,"type":"sslcert","dst_addr":"63.245.213.47","ver":"1.2","msm_id":3322890}')
+ assert(result.alert is not None)
+ assert(result.alert.level == 2)
+ assert(result.alert.description == 40)
+ assert(result.alert.description_string == "handshake_failure")
+ assert(result.is_error is True)
+ assert(result.error_message == "handshake_failure")
+ result = Result.get('{"lts":60,"rt":65.88887,"from":"134.197.42.163","dst_name":"aus5.mozilla.org","af":4,"timestamp":1452783251,"msm_name":"SSLCert","fw":4720,"alert":{"decription":99,"level":2},"method":"TLS","prb_id":10008,"dst_port":"443","ttc":31.621485,"src_addr":"134.197.42.163","group_id":3322890,"type":"sslcert","dst_addr":"63.245.213.47","ver":"1.2","msm_id":3322890}')
+ assert(result.alert is not None)
+ assert(result.alert.level == 2)
+ assert(result.alert.description == 99)
+ assert(result.alert.description_string == "Unknown")
+ assert(result.is_error is True)
+ assert(result.error_message == "Unknown")
+ result = Result.get('{"af":4,"cert":["-----BEGIN CERTIFICATE-----\\nMIIFBTCCAu2gAwIBAgIDDLHHMA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv\\nb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ\\nQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y\\ndEBjYWNlcnQub3JnMB4XDTEzMDEwNjE0MDA1NVoXDTEzMDcwNTE0MDA1NVowGDEW\\nMBQGA1UEAxQNKi5wcmV0aWNhbC5lZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\\nAQoCggEBAMS+vX7gA8TvzFwxryFFRj1OyQjnW88GvfMuGhKJopalG1EB103oRsxi\\nMcXqwFZUicpqLKHW4l [...]
+ assert(result.alert is None)
+ assert(result.is_error is False)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/ripe-atlas-sagan.git
More information about the Python-modules-commits
mailing list