o
    h                     @   sR   d dl Z d dlZd dlZd dlmZmZ d dlmZ ee	Z
G dd deZdS )    N)DictAny)CountermeasurePluginc                   @   s@   e Zd ZdZdeeef deeef fddZdefddZdS )	RandomDelayCountermeasureu(   
    随机延迟反制动作实现
    contextreturnc                 C   sj   | di }| dd}| dd}||kr||}}t||}t|d  td| d d	|iS )
u   
        执行随机延迟动作。
        :param context: 包含 'config' 键的字典，'config' 中可包含 'min_delay' 和 'max_delay' (单位: 毫秒)。
                          默认值: min_delay=100, max_delay=1000。
        :return: 包含执行结果的字典。
        config	min_delayd   	max_delayi  g     @@zApplied random delay of msZdelay_applied)getrandomrandinttimesleeploggerinfo)selfr   r   r	   r   delay r   :/root/ive/./countermeasures/random_delay/countermeasure.pyexecute   s   
z!RandomDelayCountermeasure.executec                 C   s   dS )Nz'Applies a random delay to the response.r   )r   r   r   r   get_description$   s   z)RandomDelayCountermeasure.get_descriptionN)	__name__
__module____qualname____doc__r   strr   r   r   r   r   r   r   r   
   s    "r   )r   r   loggingtypingr   r   pluginsr   	getLoggerr   r   r   r   r   r   r   <module>   s    
