From a784aed6d0316bda8eaf64b1bf97d26ea3fa47ff Mon Sep 17 00:00:00 2001 From: webamon Date: Sun, 1 Sep 2024 00:56:32 +0100 Subject: [PATCH 1/2] fix: precheck fields exists, some dont for http vs https (e.g. certificates) --- Sandbox/report.py | 93 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/Sandbox/report.py b/Sandbox/report.py index 29b761e..9a74c2c 100644 --- a/Sandbox/report.py +++ b/Sandbox/report.py @@ -71,57 +71,60 @@ class Formatting: @staticmethod def clean_data(report): - for _request in report['request']: - _request['request'].pop('initialPriority', False) - _request['request'].pop('isLinkPreload', False) - _request['request'].pop('isSameSite', False) - _request['request'].pop('mixedContentType', False) - - clean_keys = {"hasPostData": "has_post_data", "postData": "post_data", "postDataEntries": "post_data_entry", "referrerPolicy": "referrer_policy"} - for k, v in clean_keys.items(): - try: - _request['request'][v] = _request['request'].pop(k) - except: - continue - - if 'response' in _request: - _request['response'].pop('timing', False) - _request['response'].pop('alternateProtocolUsage', False) - _request['response'].pop('charset', False) - _request['response'].pop('connectionId', False) - _request['response'].pop('connectionReused', False) - _request['response'].pop('fromDiskCache', False) - _request['response'].pop('fromPrefetchCache', False) - _request['response'].pop('fromDiskCache', False) - _request['response'].pop('fromServiceWorker', False) - - clean_keys = {"encodedDataLength": 'encoded_data_length', "mimeType": "mime_type", "remoteIPAddress": "ip", "remotePort": "port", "responseTime": "response_time", "securityDetails": "security_details", "securityState": "security_state", "statusText": "status_text"} + if 'request' in report: + for _request in report['request']: + _request['request'].pop('initialPriority', False) + _request['request'].pop('isLinkPreload', False) + _request['request'].pop('isSameSite', False) + _request['request'].pop('mixedContentType', False) + + clean_keys = {"hasPostData": "has_post_data", "postData": "post_data", "postDataEntries": "post_data_entry", "referrerPolicy": "referrer_policy"} for k, v in clean_keys.items(): try: - _request['response'][v] = _request['response'].pop(k) + _request['request'][v] = _request['request'].pop(k) except: continue - for certificate in report['certificate']: - - certificate.pop('certificateId', False) - certificate.pop('certificateTransparencyCompliance', False) - certificate.pop('encryptedClientHello', False) - - clean_keys = {"keyExchange": "key_exchange", "keyExchangeGroup": "key_exchange_group", "sanList": "san_list", "serverSignatureAlgorithm": "signature_algorithm", "subjectName": "subject_name", "validFrom": "valid_from", "validTo": "valid_to"} - for k, v in clean_keys.items(): - try: - certificate[v] = certificate.pop(k) - except: - continue + if 'response' in _request: + _request['response'].pop('timing', False) + _request['response'].pop('alternateProtocolUsage', False) + _request['response'].pop('charset', False) + _request['response'].pop('connectionId', False) + _request['response'].pop('connectionReused', False) + _request['response'].pop('fromDiskCache', False) + _request['response'].pop('fromPrefetchCache', False) + _request['response'].pop('fromDiskCache', False) + _request['response'].pop('fromServiceWorker', False) + + clean_keys = {"encodedDataLength": 'encoded_data_length', "mimeType": "mime_type", "remoteIPAddress": "ip", "remotePort": "port", "responseTime": "response_time", "securityDetails": "security_details", "securityState": "security_state", "statusText": "status_text"} + for k, v in clean_keys.items(): + try: + _request['response'][v] = _request['response'].pop(k) + except: + continue + + if 'certificate' in report: + for certificate in report['certificate']: + + certificate.pop('certificateId', False) + certificate.pop('certificateTransparencyCompliance', False) + certificate.pop('encryptedClientHello', False) + + clean_keys = {"keyExchange": "key_exchange", "keyExchangeGroup": "key_exchange_group", "sanList": "san_list", "serverSignatureAlgorithm": "signature_algorithm", "subjectName": "subject_name", "validFrom": "valid_from", "validTo": "valid_to"} + for k, v in clean_keys.items(): + try: + certificate[v] = certificate.pop(k) + except: + continue - for cookie in report['cookie']: - clean_keys = {"httpOnly": "http_only", "sameSite": "same_site"} - for k, v in clean_keys.items(): - try: - cookie[v] = cookie.pop(k) - except: - continue + if 'cookie' in report: + for cookie in report['cookie']: + clean_keys = {"httpOnly": "http_only", "sameSite": "same_site"} + for k, v in clean_keys.items(): + try: + cookie[v] = cookie.pop(k) + except: + continue return report From bbeb5dfc05d814d50504cac2913c71840e4b2d4e Mon Sep 17 00:00:00 2001 From: webamon Date: Sun, 1 Sep 2024 00:59:16 +0100 Subject: [PATCH 2/2] ## [v0.2.1] - 2024-09-01 ### Fixed - (Sandbox) - Handle checking certs for http --- --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa181e..5f84145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Console) Clear filters button --- +## [v0.2.1] - 2024-09-01 +### Fixed +- (Sandbox) - Handle checking certs for http + +--- ## [v0.2.0] - 2024-08-31 ### Added