feature: Delete configloader Default config.
This commit is contained in:
@@ -29,160 +29,14 @@ from scapy.sendrecv import AsyncSniffer
|
|||||||
from urllib.parse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
class ConfigLoader:
|
class ConfigLoader:
|
||||||
DEFAULT_CONFIGS = {
|
|
||||||
'Firewall_DenyDrop_DNS': {
|
|
||||||
'conn_timeout': 3,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyRedirect_A_DNS': {
|
|
||||||
'conn_timeout': 3,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyRedirect_AAAA_DNS': {
|
|
||||||
'conn_timeout': 3,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyRedirect_ARangeTTL_DNS': {
|
|
||||||
'conn_timeout': 3,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyRedirect_AAAARangeTTL_DNS': {
|
|
||||||
'conn_timeout': 3,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'test_dnsRequest_allow_rdtype_a': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'test_dnsRequest_allow_rdtype_aaaa': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'test_dnsRequest_allow_rdtype_cname': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_CertExpired': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_CertSelfSigned': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_CertUntrustedRoot': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Redirect_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Deny_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Replace_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Hijack_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Insert_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Redirect_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Deny_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Replace_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Hijack_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Insert_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_1k': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_4k': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_16k': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_64k': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_256k': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_1M': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_4M': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_16M': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Intercept_HTTPS_Response_64M': {
|
|
||||||
'conn_timeout': 12,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_Allow_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyDrop_HTTP': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyReset_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyBlock_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_Allow_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyDrop_HTTPS': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyReset_HTTPS': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyReset_FilterHost_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Firewall_DenyReset_FilterURL_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Deny_FilterHost_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Proxy_Manipulation_Deny_FilterURL_HTTP': {
|
|
||||||
'conn_timeout': 1,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Shaping_RateLimit0bps_HTTP': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Shaping_RateLimit0bps_HTTPS': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Shaping_RateLimit1000gbps_HTTP': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
},
|
|
||||||
'Shaping_RateLimit1000gbps_HTTPS': {
|
|
||||||
'conn_timeout': 4,'max_recv_speed_large': 6553600
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, config_path: str):
|
def __init__(self, config_path: str):
|
||||||
self.__config_path = config_path
|
self.__config_path = config_path
|
||||||
self.__configs = copy.deepcopy(self.DEFAULT_CONFIGS)
|
self.__configs = self._load_configs()
|
||||||
self.__load_configs()
|
|
||||||
|
|
||||||
def __load_configs(self):
|
def _load_configs(self):
|
||||||
config_parser = ConfigParser()
|
config_parser = ConfigParser()
|
||||||
config_parser.read(self.__config_path, encoding='UTF-8')
|
config_parser.read(self.__config_path, encoding='UTF-8')
|
||||||
for section in config_parser.sections():
|
return config_parser.sections()
|
||||||
if section in self.__configs:
|
|
||||||
self.__configs[section].update(config_parser.items(section))
|
|
||||||
else:
|
|
||||||
self.__configs[section] = dict(config_parser.items(section))
|
|
||||||
|
|
||||||
def get_value_by_section_and_key(self, section, key):
|
def get_value_by_section_and_key(self, section, key):
|
||||||
if section in self.__configs and key in self.__configs[section]:
|
if section in self.__configs and key in self.__configs[section]:
|
||||||
@@ -192,7 +46,7 @@ class ConfigLoader:
|
|||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
else:
|
else:
|
||||||
raise KeyError("%s not in configs or %s.%s not in configs." % (section, section, key))
|
return None
|
||||||
|
|
||||||
class ServiceFunctionConfigLoader:
|
class ServiceFunctionConfigLoader:
|
||||||
TABLE_NAME = "service_function_maps"
|
TABLE_NAME = "service_function_maps"
|
||||||
@@ -1223,259 +1077,345 @@ class DiagnoseCasesRunner:
|
|||||||
"name": "Firewall_Allow_HTTP",
|
"name": "Firewall_Allow_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_allow_protocol_http,
|
"test_function": self._firewall_case.action_allow_protocol_http,
|
||||||
"request_content": "http://http.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://http.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_Allow_HTTPS",
|
"name": "Firewall_Allow_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._firewall_case.action_allow_protocol_https,
|
"test_function": self._firewall_case.action_allow_protocol_https,
|
||||||
"request_content": "https://sha512.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://sha512.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyReset_HTTP",
|
"name": "Firewall_DenyReset_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http,
|
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http,
|
||||||
"request_content": "http://http-dynamic-login.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://http-dynamic-login.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyReset_HTTPS",
|
"name": "Firewall_DenyReset_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_https,
|
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_https,
|
||||||
"request_content": "https://rsa4096.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://rsa4096.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyReset_FilterHost_HTTP",
|
"name": "Firewall_DenyReset_FilterHost_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http_filter_host,
|
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http_filter_host,
|
||||||
"request_content": "http://testing-firewall-filter-host.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://testing-firewall-filter-host.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyReset_FilterURL_HTTP",
|
"name": "Firewall_DenyReset_FilterURL_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http_filter_url,
|
"test_function": self._firewall_case.action_deny_subaction_reset_protocol_http_filter_url,
|
||||||
"request_content": "http://testing-firewall-filter-url.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://testing-firewall-filter-url.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyBlock_HTTP",
|
"name": "Firewall_DenyBlock_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_block_protocol_http,
|
"test_function": self._firewall_case.action_deny_subaction_block_protocol_http,
|
||||||
"request_content": "http://http-login.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://http-login.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyDrop_HTTP",
|
"name": "Firewall_DenyDrop_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_http,
|
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_http,
|
||||||
"request_content": "http://http-credit-card.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://http-credit-card.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyDrop_HTTPS",
|
"name": "Firewall_DenyDrop_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_https,
|
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_https,
|
||||||
"request_content": "https://rsa2048.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://rsa2048.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyDrop_DNS",
|
"name": "Firewall_DenyDrop_DNS",
|
||||||
"protocol_type": "dns",
|
"protocol_type": "dns",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_dns,
|
"test_function": self._firewall_case.action_deny_subaction_drop_protocol_dns,
|
||||||
"request_content": "dnstest.deny-drop-ipv4.selftest.gdnt-cloud.website"
|
"request_content": "dnstest.deny-drop-ipv4.selftest.gdnt-cloud.website",
|
||||||
|
'conn_timeout': 3,
|
||||||
|
'max_recv_speed_large': 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyRedirect_A_DNS",
|
"name": "Firewall_DenyRedirect_A_DNS",
|
||||||
"protocol_type": "dns",
|
"protocol_type": "dns",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_a,
|
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_a,
|
||||||
"request_content": "dnstest.deny-redirect-a-ipv4.selftest.gdnt-cloud.website"
|
"request_content": "dnstest.deny-redirect-a-ipv4.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 3,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyRedirect_AAAA_DNS",
|
"name": "Firewall_DenyRedirect_AAAA_DNS",
|
||||||
"protocol_type": "dns",
|
"protocol_type": "dns",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_aaaa,
|
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_aaaa,
|
||||||
"request_content": "dnstest.deny-redirect-4a-ipv6.selftest.gdnt-cloud.website"
|
"request_content": "dnstest.deny-redirect-4a-ipv6.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 3,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyRedirect_ARangeTTL_DNS",
|
"name": "Firewall_DenyRedirect_ARangeTTL_DNS",
|
||||||
"protocol_type": "dns",
|
"protocol_type": "dns",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_a_range_ttl,
|
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_a_range_ttl,
|
||||||
"request_content": "dnstest.deny-redirect-a-rttl-ipv4.selftest.gdnt-cloud.website"
|
"request_content": "dnstest.deny-redirect-a-rttl-ipv4.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 3,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Firewall_DenyRedirect_AAAARangeTTL_DNS",
|
"name": "Firewall_DenyRedirect_AAAARangeTTL_DNS",
|
||||||
"protocol_type": "dns",
|
"protocol_type": "dns",
|
||||||
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_aaaa_range_ttl,
|
"test_function": self._firewall_case.action_deny_subaction_redirect_protocol_dns_type_aaaa_range_ttl,
|
||||||
"request_content": "dnstest.deny-redirect-4a-rttl-ipv6.selftest.gdnt-cloud.website"
|
"request_content": "dnstest.deny-redirect-4a-rttl-ipv6.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 3,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS",
|
"name": "Proxy_Intercept_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https,
|
"test_function": self._proxy_case.action_intercept_protocol_https,
|
||||||
"request_content": "https://sha256.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://sha256.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_CertExpired",
|
"name": "Proxy_Intercept_HTTPS_CertExpired",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
||||||
"request_content": "https://expired.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://expired.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_CertSelfSigned",
|
"name": "Proxy_Intercept_HTTPS_CertSelfSigned",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
||||||
"request_content": "https://self-signed.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://self-signed.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_CertUntrustedRoot",
|
"name": "Proxy_Intercept_HTTPS_CertUntrustedRoot",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
"test_function": self._proxy_case.action_intercept_protocol_https_cert_error,
|
||||||
"request_content": "https://untrusted-root.badssl.selftest.gdnt-cloud.website"
|
"request_content": "https://untrusted-root.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_1k",
|
"name": "Proxy_Intercept_HTTPS_Response_1k",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_1k,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_1k,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/1k"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/1k",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_4k",
|
"name": "Proxy_Intercept_HTTPS_Response_4k",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_4k,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_4k,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/4k"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/4k",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_16k",
|
"name": "Proxy_Intercept_HTTPS_Response_16k",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_16k,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_16k,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/16k"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/16k",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_64k",
|
"name": "Proxy_Intercept_HTTPS_Response_64k",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_64k,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_64k,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/64k"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/64k",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_256k",
|
"name": "Proxy_Intercept_HTTPS_Response_256k",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_256k,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_256k,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/256k"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/256k",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_1M",
|
"name": "Proxy_Intercept_HTTPS_Response_1M",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_1M,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_1M,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/1M"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/1M",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_4M",
|
"name": "Proxy_Intercept_HTTPS_Response_4M",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_4M,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_4M,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/4M"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/4M",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_16M",
|
"name": "Proxy_Intercept_HTTPS_Response_16M",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_16M,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_16M,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/16M"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/16M",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Intercept_HTTPS_Response_64M",
|
"name": "Proxy_Intercept_HTTPS_Response_64M",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_64M,
|
"test_function": self._proxy_case.action_intercept_protocol_https_download_size_64M,
|
||||||
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/64M"
|
"request_content": "https://testing-download.badssl.selftest.gdnt-cloud.website/resources/64M",
|
||||||
|
"conn_timeout": 12,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Redirect_HTTP",
|
"name": "Proxy_Manipulation_Redirect_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_redirect_protocol_http,
|
"test_function": self._proxy_case.action_redirect_protocol_http,
|
||||||
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyRedirect.js"
|
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyRedirect.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Redirect_HTTPS",
|
"name": "Proxy_Manipulation_Redirect_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_redirect_protocol_https,
|
"test_function": self._proxy_case.action_redirect_protocol_https,
|
||||||
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyRedirect.js"
|
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyRedirect.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Replace_HTTP",
|
"name": "Proxy_Manipulation_Replace_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_replace_protocol_http,
|
"test_function": self._proxy_case.action_replace_protocol_http,
|
||||||
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyReplace.js"
|
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyReplace.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Replace_HTTPS",
|
"name": "Proxy_Manipulation_Replace_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_replace_protocol_https,
|
"test_function": self._proxy_case.action_replace_protocol_https,
|
||||||
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyReplace.js"
|
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyReplace.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Deny_HTTP",
|
"name": "Proxy_Manipulation_Deny_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_block_protocol_http,
|
"test_function": self._proxy_case.action_block_protocol_http,
|
||||||
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyBlock.js"
|
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyBlock.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Deny_HTTPS",
|
"name": "Proxy_Manipulation_Deny_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_block_protocol_https,
|
"test_function": self._proxy_case.action_block_protocol_https,
|
||||||
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyBlock.js"
|
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyBlock.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Deny_FilterHost_HTTP",
|
"name": "Proxy_Manipulation_Deny_FilterHost_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_deny_protocol_http_filter_host,
|
"test_function": self._proxy_case.action_deny_protocol_http_filter_host,
|
||||||
"request_content": "http://testing-proxy-filter-host.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://testing-proxy-filter-host.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Deny_FilterURL_HTTP",
|
"name": "Proxy_Manipulation_Deny_FilterURL_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_deny_protocol_http_filter_url,
|
"test_function": self._proxy_case.action_deny_protocol_http_filter_url,
|
||||||
"request_content": "http://testing-proxy-filter-url.badssl.selftest.gdnt-cloud.website"
|
"request_content": "http://testing-proxy-filter-url.badssl.selftest.gdnt-cloud.website",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Hijack_HTTP",
|
"name": "Proxy_Manipulation_Hijack_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_hijack_protocol_http,
|
"test_function": self._proxy_case.action_hijack_protocol_http,
|
||||||
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyHijack.js"
|
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyHijack.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Hijack_HTTPS",
|
"name": "Proxy_Manipulation_Hijack_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_hijack_protocol_https,
|
"test_function": self._proxy_case.action_hijack_protocol_https,
|
||||||
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyHijack.js"
|
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyHijack.js",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Insert_HTTP",
|
"name": "Proxy_Manipulation_Insert_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._proxy_case.action_insert_protocol_http,
|
"test_function": self._proxy_case.action_insert_protocol_http,
|
||||||
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyInsert.html"
|
"request_content": "http://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyInsert.html",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Proxy_Manipulation_Insert_HTTPS",
|
"name": "Proxy_Manipulation_Insert_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._proxy_case.action_insert_protocol_https,
|
"test_function": self._proxy_case.action_insert_protocol_https,
|
||||||
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyInsert.html"
|
"request_content": "https://web-replay.badssl.selftest.gdnt-cloud.website/resources/proxyInsert.html",
|
||||||
|
"conn_timeout": 1,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Shaping_RateLimit0bps_HTTP",
|
"name": "Shaping_RateLimit0bps_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._shaping_case.rate_limit_0bps_protocol_http,
|
"test_function": self._shaping_case.rate_limit_0bps_protocol_http,
|
||||||
"request_content": "http://testing-rate-limit-0bps.badssl.selftest.gdnt-cloud.website/resources/16M"
|
"request_content": "http://testing-rate-limit-0bps.badssl.selftest.gdnt-cloud.website/resources/16M",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Shaping_RateLimit0bps_HTTPS",
|
"name": "Shaping_RateLimit0bps_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._shaping_case.rate_limit_0bps_protocol_https,
|
"test_function": self._shaping_case.rate_limit_0bps_protocol_https,
|
||||||
"request_content": "https://testing-rate-limit-0bps.badssl.selftest.gdnt-cloud.website/resources/16M"
|
"request_content": "https://testing-rate-limit-0bps.badssl.selftest.gdnt-cloud.website/resources/16M",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Shaping_RateLimit1000gbps_HTTP",
|
"name": "Shaping_RateLimit1000gbps_HTTP",
|
||||||
"protocol_type": "http",
|
"protocol_type": "http",
|
||||||
"test_function": self._shaping_case.rate_limit_1000gbps_protocol_http,
|
"test_function": self._shaping_case.rate_limit_1000gbps_protocol_http,
|
||||||
"request_content": "http://testing-rate-limit-1000gbps.badssl.selftest.gdnt-cloud.website/resources/16M"
|
"request_content": "http://testing-rate-limit-1000gbps.badssl.selftest.gdnt-cloud.website/resources/16M",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Shaping_RateLimit1000gbps_HTTPS",
|
"name": "Shaping_RateLimit1000gbps_HTTPS",
|
||||||
"protocol_type": "https",
|
"protocol_type": "https",
|
||||||
"test_function": self._shaping_case.rate_limit_1000gbps_protocol_https,
|
"test_function": self._shaping_case.rate_limit_1000gbps_protocol_https,
|
||||||
"request_content": "https://testing-rate-limit-1000gbps.badssl.selftest.gdnt-cloud.website/resources/16M"
|
"request_content": "https://testing-rate-limit-1000gbps.badssl.selftest.gdnt-cloud.website/resources/16M",
|
||||||
|
"conn_timeout": 4,
|
||||||
|
"max_recv_speed_large": 6553600
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1512,8 +1452,8 @@ class DiagnoseCasesRunner:
|
|||||||
exporter.export()
|
exporter.export()
|
||||||
|
|
||||||
def _run_one_case(self, case_info, resolve_builder, exporter):
|
def _run_one_case(self, case_info, resolve_builder, exporter):
|
||||||
conn_timeout = self._get_conn_timeout_from_configs(case_info["name"])
|
conn_timeout = self._get_conn_timeout_from_configs(case_info)
|
||||||
max_recv_speed_large = self._get_max_recv_speed_large_from_configs(case_info["name"])
|
max_recv_speed_large = self._get_max_recv_speed_from_configs(case_info)
|
||||||
|
|
||||||
test_func = case_info.get("test_function")
|
test_func = case_info.get("test_function")
|
||||||
if test_func:
|
if test_func:
|
||||||
@@ -1526,11 +1466,19 @@ class DiagnoseCasesRunner:
|
|||||||
|
|
||||||
exporter.append_case_result(case_info["name"], ret)
|
exporter.append_case_result(case_info["name"], ret)
|
||||||
|
|
||||||
def _get_conn_timeout_from_configs(self, section) -> int:
|
def _get_conn_timeout_from_configs(self, case_info):
|
||||||
return self._config_loader.get_value_by_section_and_key(section, "conn_timeout")
|
conn_timeout = self._config_loader.get_value_by_section_and_key(case_info["name"], "conn_timeout")
|
||||||
|
if conn_timeout is not None:
|
||||||
|
return conn_timeout
|
||||||
|
else:
|
||||||
|
return case_info["conn_timeout"]
|
||||||
|
|
||||||
def _get_max_recv_speed_large_from_configs(self, section) -> int:
|
def _get_max_recv_speed_from_configs(self, case_info):
|
||||||
return self._config_loader.get_value_by_section_and_key(section, "max_recv_speed_large")
|
max_recv_speed = self._config_loader.get_value_by_section_and_key(case_info["name"], "max_recv_speed_large")
|
||||||
|
if max_recv_speed is not None:
|
||||||
|
return max_recv_speed
|
||||||
|
else:
|
||||||
|
return case_info["max_recv_speed_large"]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user