A varredura de portas é uma técnica para identificar o estado de uma porta de rede. Essa técnica encontra portas abertas e vulnerabilidades na rede ou sistema. A varredura de portas é um primeiro passo em diferentes vetores de ataque. Portanto, é essencial detectar essas varreduras de portas para limitar os seus impactos. Os métodos tradicionais para detectar varreduras de portas são limitados porque se baseiam em regras estáticas e no conhecimento prévio da estrutura da rede. Este trabalho apresenta um novo método para a detecção de varredura de portas em comunicação na Internet of Things (IoT), utilizando técnicas de aprendizado de máquina. O método usa recursos de tráfego específicos para criar um perfil de comportamento de ataque. Por meio de uma rede neural, o modelo desenvolvido identifica a varredura de portas independentemente da topologia da rede. Os resultados mostram uma eficiência de até 90% na identificação de uma varredura de portas.