SmtpLibrary (smtp.py)

Nettacker · nettacker/core/lib/smtp.py · python · Apache-2.0
email

Provides SMTP client functionality for email protocol authentication and brute-force testing during security assessments.

# Source: https://github.com/OWASP/Nettacker | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
import smtplib

from nettacker.core.lib.base import BaseEngine, BaseLibrary


class SmtpLibrary(BaseLibrary):
    client = smtplib.SMTP

    def brute_force(self, host, port, username, password, timeout):
        connection = self.client(host, port, timeout=timeout)
        connection.login(username, password)
        connection.close()

        return {
            "host": host,
            "port": port,
            "username": username,
            "password": password,
        }


class SmtpEngine(BaseEngine):
    library = SmtpLibrary

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key