bugfix: Comment the config and Using the built-in code config.
This commit is contained in:
@@ -30,17 +30,19 @@ from urllib.parse import urlparse, parse_qs
|
|||||||
|
|
||||||
class ConfigLoader:
|
class ConfigLoader:
|
||||||
def __init__(self, config_path: str):
|
def __init__(self, config_path: str):
|
||||||
self.__config_path = config_path
|
self._config_path = config_path
|
||||||
self.__configs = self._load_configs()
|
self._configs = {}
|
||||||
|
if os.path.exists(self._config_path):
|
||||||
|
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')
|
||||||
return config_parser.sections()
|
return config_parser.sections()
|
||||||
|
|
||||||
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]:
|
||||||
value = self.__configs[section][key]
|
value = self._configs[section][key]
|
||||||
if isinstance(value, str) and value.isdigit():
|
if isinstance(value, str) and value.isdigit():
|
||||||
return int(value)
|
return int(value)
|
||||||
else:
|
else:
|
||||||
@@ -223,6 +225,7 @@ class TcpPacketsCapture:
|
|||||||
self._filter = f"tcp and src host {self._server_ip} and src port {self._server_port}"
|
self._filter = f"tcp and src host {self._server_ip} and src port {self._server_port}"
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
time.sleep(0.5)
|
||||||
self._sniff_thread = AsyncSniffer(iface=self._iface_names, prn=self._packet_callback, filter=self._filter)
|
self._sniff_thread = AsyncSniffer(iface=self._iface_names, prn=self._packet_callback, filter=self._filter)
|
||||||
self._sniff_thread.start()
|
self._sniff_thread.start()
|
||||||
|
|
||||||
@@ -252,8 +255,10 @@ class TcpPacketsCapture:
|
|||||||
self._quadruple_to_dscp_table[quadruple] = dscp_value
|
self._quadruple_to_dscp_table[quadruple] = dscp_value
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self._sniff_thread.stop()
|
time.sleep(0.5)
|
||||||
self._sniff_thread.join()
|
if self._sniff_thread is not None and self._sniff_thread.running:
|
||||||
|
self._sniff_thread.stop()
|
||||||
|
self._sniff_thread.join()
|
||||||
|
|
||||||
def read_dscp_value_by_quadruple(self, quadruple):
|
def read_dscp_value_by_quadruple(self, quadruple):
|
||||||
if quadruple in self._quadruple_to_dscp_table:
|
if quadruple in self._quadruple_to_dscp_table:
|
||||||
@@ -1192,7 +1197,7 @@ class FirewallCasesRunner:
|
|||||||
class ResultExportBuilder:
|
class ResultExportBuilder:
|
||||||
COLUMN_0 = "Test cases"
|
COLUMN_0 = "Test cases"
|
||||||
COLUMN_1 = "Result"
|
COLUMN_1 = "Result"
|
||||||
COLUMN_2 = "Fail Reason"
|
COLUMN_2 = "Description"
|
||||||
RESULT_OK = "ok"
|
RESULT_OK = "ok"
|
||||||
RESULT_FAIL = "FAIL"
|
RESULT_FAIL = "FAIL"
|
||||||
DEFAULT_INFO = "-"
|
DEFAULT_INFO = "-"
|
||||||
|
|||||||
@@ -1,225 +1,225 @@
|
|||||||
# enabled = 1 run this case
|
# enabled = 1 run this case
|
||||||
#Connection TIMEOUT, in seconds
|
#Connection TIMEOUT, in seconds
|
||||||
#max_recv_speed_large byte/s
|
#max_recv_speed byte/s
|
||||||
[Firewall_DenyDrop_DNS]
|
# [Firewall_DenyDrop_DNS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 3
|
# conn_timeout = 3
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyRedirect_A_DNS]
|
# [Firewall_DenyRedirect_A_DNS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 3
|
# conn_timeout = 3
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyRedirect_AAAA_DNS]
|
# [Firewall_DenyRedirect_AAAA_DNS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 3
|
# conn_timeout = 3
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyRedirect_ARangeTTL_DNS]
|
# [Firewall_DenyRedirect_ARangeTTL_DNS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 3
|
# conn_timeout = 3
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyRedirect_AAAARangeTTL_DNS]
|
# [Firewall_DenyRedirect_AAAARangeTTL_DNS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 3
|
# conn_timeout = 3
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS]
|
# [Proxy_Intercept_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_CertExpired]
|
# [Proxy_Intercept_HTTPS_CertExpired]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_CertSelfSigned]
|
# [Proxy_Intercept_HTTPS_CertSelfSigned]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_CertUntrustedRoot]
|
# [Proxy_Intercept_HTTPS_CertUntrustedRoot]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Redirect_HTTPS]
|
# [Proxy_Manipulation_Redirect_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Deny_HTTPS]
|
# [Proxy_Manipulation_Deny_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Replace_HTTPS]
|
# [Proxy_Manipulation_Replace_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Hijack_HTTPS]
|
# [Proxy_Manipulation_Hijack_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Insert_HTTPS]
|
# [Proxy_Manipulation_Insert_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Redirect_HTTP]
|
# [Proxy_Manipulation_Redirect_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Deny_HTTP]
|
# [Proxy_Manipulation_Deny_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Replace_HTTP]
|
# [Proxy_Manipulation_Replace_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Hijack_HTTP]
|
# [Proxy_Manipulation_Hijack_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Insert_HTTP]
|
# [Proxy_Manipulation_Insert_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_1k]
|
# [Proxy_Intercept_HTTPS_Response_1k]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_4k]
|
# [Proxy_Intercept_HTTPS_Response_4k]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_16k]
|
# [Proxy_Intercept_HTTPS_Response_16k]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_64k]
|
# [Proxy_Intercept_HTTPS_Response_64k]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_256k]
|
# [Proxy_Intercept_HTTPS_Response_256k]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_1M]
|
# [Proxy_Intercept_HTTPS_Response_1M]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_4M]
|
# [Proxy_Intercept_HTTPS_Response_4M]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_16M]
|
# [Proxy_Intercept_HTTPS_Response_16M]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 4
|
# conn_timeout = 4
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Intercept_HTTPS_Response_64M]
|
# [Proxy_Intercept_HTTPS_Response_64M]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_Allow_HTTP]
|
# [Firewall_Allow_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyDrop_HTTP]
|
# [Firewall_DenyDrop_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 4
|
# conn_timeout = 4
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyReset_HTTP]
|
# [Firewall_DenyReset_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyBlock_HTTP]
|
# [Firewall_DenyBlock_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_Allow_HTTPS]
|
# [Firewall_Allow_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyDrop_HTTPS]
|
# [Firewall_DenyDrop_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 4
|
# conn_timeout = 4
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyReset_HTTPS]
|
# [Firewall_DenyReset_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyReset_FilterHost_HTTP]
|
# [Firewall_DenyReset_FilterHost_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Firewall_DenyReset_FilterURL_HTTP]
|
# [Firewall_DenyReset_FilterURL_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Deny_FilterHost_HTTP]
|
# [Proxy_Manipulation_Deny_FilterHost_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Proxy_Manipulation_Deny_FilterURL_HTTP]
|
# [Proxy_Manipulation_Deny_FilterURL_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 1
|
# conn_timeout = 1
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Shaping_RateLimit0bps_HTTP]
|
# [Shaping_RateLimit0bps_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Shaping_RateLimit0bps_HTTPS]
|
# [Shaping_RateLimit0bps_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Shaping_RateLimit1000gbps_HTTP]
|
# [Shaping_RateLimit1000gbps_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Shaping_RateLimit1000gbps_HTTPS]
|
# [Shaping_RateLimit1000gbps_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
max_recv_speed_large = 6553600
|
# max_recv_speed = 6553600
|
||||||
|
|
||||||
[Shaping_NoRateLimit_HTTP]
|
# [Shaping_NoRateLimit_HTTP]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
|
|
||||||
[Shaping_NoRateLimit_HTTPS]
|
# [Shaping_NoRateLimit_HTTPS]
|
||||||
enabled = 1
|
# enabled = 1
|
||||||
conn_timeout = 12
|
# conn_timeout = 12
|
||||||
Reference in New Issue
Block a user