diff --git a/mitmproxy/io/compat.py b/mitmproxy/io/compat.py index 8afbbf5cc..61d436d99 100644 --- a/mitmproxy/io/compat.py +++ b/mitmproxy/io/compat.py @@ -312,6 +312,10 @@ def convert_12_13(data): def convert_13_14(data): data["version"] = 14 data["comment"] = "" + # bugfix for https://github.com/mitmproxy/mitmproxy/issues/4576 + if data.get("response", None) and data["response"]["timestamp_start"] is None: + data["response"]["timestamp_start"] = data["request"]["timestamp_end"] + data["response"]["timestamp_end"] = data["request"]["timestamp_end"] + 1 return data diff --git a/test/helper_tools/dumperview.py b/test/helper_tools/dumperview.py index e17dc77bb..b672ebaf9 100755 --- a/test/helper_tools/dumperview.py +++ b/test/helper_tools/dumperview.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import click from mitmproxy.addons import dumper diff --git a/test/helper_tools/inspect_dumpfile.py b/test/helper_tools/inspect_dumpfile.py index b2201f406..77006a7a9 100644 --- a/test/helper_tools/inspect_dumpfile.py +++ b/test/helper_tools/inspect_dumpfile.py @@ -1,8 +1,9 @@ +#!/usr/bin/env python3 from pprint import pprint import click -from mitmproxy import tnetstring +from mitmproxy.io import tnetstring def read_tnetstring(input): diff --git a/test/mitmproxy/data/dumpfile-018.mitm b/test/mitmproxy/data/dumpfile-018.mitm index 6a27b5a66..526316a75 100644 --- a/test/mitmproxy/data/dumpfile-018.mitm +++ b/test/mitmproxy/data/dumpfile-018.mitm @@ -1,4 +1,72 @@ -7816:4:type;4:http;2:id;36:55367415-10f5-4938-b69f-8a523394f947;8:response;1851:15:timestamp_start;17:1482157524.361187^12:http_version;8:HTTP/1.1,7:content;1270: +7780:6:marked;5:false!11:client_conn;216:19:timestamp_ssl_setup;18:1482157523.9086578^7:address;53:7:address;20:9:127.0.0.1;5:52774#]8:use_ipv6;5:false!}10:clientcert;0:~13:timestamp_end;0:~15:ssl_established;4:true!15:timestamp_start;18:1482157522.8949482^}11:server_conn;5143:3:sni;15:www.example.com;7:address;58:7:address;25:15:www.example.com;3:443#]8:use_ipv6;5:false!}3:via;2570:7:address;58:7:address;25:15:www.example.com;3:443#]8:use_ipv6;5:false!}13:timestamp_end;0:~4:cert;2122:-----BEGIN CERTIFICATE----- +MIIF8jCCBNqgAwIBAgIQDmTF+8I2reFLFyrrQceMsDANBgkqhkiG9w0BAQsFADBw +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNz +dXJhbmNlIFNlcnZlciBDQTAeFw0xNTExMDMwMDAwMDBaFw0xODExMjgxMjAwMDBa +MIGlMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxML +TG9zIEFuZ2VsZXMxPDA6BgNVBAoTM0ludGVybmV0IENvcnBvcmF0aW9uIGZvciBB +c3NpZ25lZCBOYW1lcyBhbmQgTnVtYmVyczETMBEGA1UECxMKVGVjaG5vbG9neTEY +MBYGA1UEAxMPd3d3LmV4YW1wbGUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAs0CWL2FjPiXBl61lRfvvE0KzLJmG9LWAC3bcBjgsH6NiVVo2dt6u +Xfzi5bTm7F3K7srfUBYkLO78mraM9qizrHoIeyofrV/n+pZZJauQsPjCPxMEJnRo +D8Z4KpWKX0LyDu1SputoI4nlQ/htEhtiQnuoBfNZxF7WxcxGwEsZuS1KcXIkHl5V +RJOreKFHTaXcB1qcZ/QRaBIv0yhxvK1yBTwWddT4cli6GfHcCe3xGMaSL328Fgs3 +jYrvG29PueB6VJi/tbbPu6qTfwp/H1brqdjh29U52Bhb0fJkM9DWxCP/Cattcc7a +z8EXnCO+LK8vkhw/kAiJWPKx4RBvgy73nwIDAQABo4ICUDCCAkwwHwYDVR0jBBgw +FoAUUWj/kK8CB3U8zNllZGKiErhZcjswHQYDVR0OBBYEFKZ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wDSiIIWIWJiJGbEeIO0TIFwEVWTOnbNl/faPXpk5IRXicapqiII= +-----END CERTIFICATE----- +,14:source_address;57:7:address;24:12:10.67.53.133;5:52775#]8:use_ipv6;5:false!}15:timestamp_start;18:1482157523.9086578^10:ip_address;56:7:address;23:13:93.184.216.34;3:443#]8:use_ipv6;5:false!}3:sni;15:www.example.com;3:via;0:~19:timestamp_ssl_setup;17:1482157524.260993^19:timestamp_tcp_setup;18:1482157524.0081189^15:ssl_established;4:true!}13:timestamp_end;0:~4:cert;2122:-----BEGIN CERTIFICATE----- +MIIF8jCCBNqgAwIBAgIQDmTF+8I2reFLFyrrQceMsDANBgkqhkiG9w0BAQsFADBw +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNz +dXJhbmNlIFNlcnZlciBDQTAeFw0xNTExMDMwMDAwMDBaFw0xODExMjgxMjAwMDBa +MIGlMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxML +TG9zIEFuZ2VsZXMxPDA6BgNVBAoTM0ludGVybmV0IENvcnBvcmF0aW9uIGZvciBB +c3NpZ25lZCBOYW1lcyBhbmQgTnVtYmVyczETMBEGA1UECxMKVGVjaG5vbG9neTEY +MBYGA1UEAxMPd3d3LmV4YW1wbGUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAs0CWL2FjPiXBl61lRfvvE0KzLJmG9LWAC3bcBjgsH6NiVVo2dt6u +Xfzi5bTm7F3K7srfUBYkLO78mraM9qizrHoIeyofrV/n+pZZJauQsPjCPxMEJnRo +D8Z4KpWKX0LyDu1SputoI4nlQ/htEhtiQnuoBfNZxF7WxcxGwEsZuS1KcXIkHl5V +RJOreKFHTaXcB1qcZ/QRaBIv0yhxvK1yBTwWddT4cli6GfH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tZm2ipWVuMRM+zgpRVM6nVJ9F3vFfUSHOb4/JsEIUvPY+d8/Krc+kPQwLvy +ieqRbcuFjmqfyPmUv1U9QoI4TQikpw7TZU0zYZANP4C/gj4Ry48/znmUaRvy2kvI +l7gRQ21qJTK5suoiYoYNo3J9T+pXPGU7Lydz/HwW+w0DpArtAaukI8aNX4ohFUKS +wDSiIIWIWJiJGbEeIO0TIFwEVWTOnbNl/faPXpk5IRXicapqiII= +-----END CERTIFICATE----- +,19:timestamp_ssl_setup;17:1482157524.260993^14:source_address;57:7:address;24:12:10.67.53.133;5:52775#]8:use_ipv6;5:false!}15:ssl_established;4:true!19:timestamp_tcp_setup;18:1482157524.0081189^15:timestamp_start;18:1482157523.9086578^10:ip_address;56:7:address;23:13:93.184.216.34;3:443#]8:use_ipv6;5:false!}}11:intercepted;5:false!5:error;0:~7:version;13:1:0#2:18#1:2#]7:request;396:6:scheme;5:https,4:host;15:www.example.com,10:stickyauth;5:false!4:path;1:/,13:timestamp_end;18:1482157523.9086578^12:http_version;8:HTTP/1.1,15:timestamp_start;18:1482157523.9086578^7:headers;82:29:10:User-Agent,11:curl/7.35.0,]26:4:Host,15:www.example.com,]15:6:Accept,3:*/*,]]6:method;3:GET,12:stickycookie;5:false!7:content;0:,4:port;3:443#17:first_line_format;8:relative;9:is_replay;5:false!}8:response;1815:7:headers;410:25:13:Accept-Ranges,5:bytes,]35:13:Cache-Control,14:max-age=604800,]28:12:Content-Type,9:text/html,]40:4:Date,29:Mon, 19 Dec 2016 14:25:24 GMT,]22:4:Etag,11:"359670651",]43:7:Expires,29:Mon, 26 Dec 2016 14:25:24 GMT,]50:13:Last-Modified,29:Fri, 09 Aug 2013 23:54:35 GMT,]27:6:Server,14:ECS (iad/18CB),]26:4:Vary,15:Accept-Encoding,]16:7:X-Cache,3:HIT,]25:17:x-ec-custom-error,1:1,]25:14:Content-Length,4:1270,]]6:reason;2:OK,11:status_code;3:200#13:timestamp_end;0:~7:content;1270: