diff --git a/portspoof_py/server.py b/portspoof_py/server.py index 6417666..dac8b3f 100644 --- a/portspoof_py/server.py +++ b/portspoof_py/server.py @@ -2,10 +2,14 @@ asyncio TCP server — connection handler with SO_ORIGINAL_DST support. """ import asyncio +import random import socket import struct from typing import Optional +_DELAY_MIN = 0.2 # seconds +_DELAY_MAX = 2.0 # seconds + from .config import Config from .logger import Logger @@ -58,6 +62,7 @@ async def _handle( if banner: writer.write(banner) await writer.drain() + await asyncio.sleep(random.uniform(_DELAY_MIN, _DELAY_MAX)) except (ConnectionResetError, BrokenPipeError): pass finally: