__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Credential managers for L{twisted.mail}.
"""
import hashlib
import hmac
from zope.interface import implementer
from twisted.cred import credentials
from twisted.mail._except import IllegalClientResponse
from twisted.mail.interfaces import IChallengeResponse, IClientAuthentication
from twisted.python.compat import nativeString
@implementer(IClientAuthentication)
class CramMD5ClientAuthenticator:
def __init__(self, user):
self.user = user
def getName(self):
return b"CRAM-MD5"
def challengeResponse(self, secret, chal):
response = hmac.HMAC(secret, chal, digestmod=hashlib.md5).hexdigest()
return self.user + b" " + response.encode("ascii")
@implementer(IClientAuthentication)
class LOGINAuthenticator:
def __init__(self, user):
self.user = user
self.challengeResponse = self.challengeUsername
def getName(self):
return b"LOGIN"
def challengeUsername(self, secret, chal):
# Respond to something like "Username:"
self.challengeResponse = self.challengeSecret
return self.user
def challengeSecret(self, secret, chal):
# Respond to something like "Password:"
return secret
@implementer(IClientAuthentication)
class PLAINAuthenticator:
def __init__(self, user):
self.user = user
def getName(self):
return b"PLAIN"
def challengeResponse(self, secret, chal):
return b"\0" + self.user + b"\0" + secret
@implementer(IChallengeResponse)
class LOGINCredentials(credentials.UsernamePassword):
def __init__(self):
self.challenges = [b"Password\0", b"User Name\0"]
self.responses = [b"password", b"username"]
credentials.UsernamePassword.__init__(self, None, None)
def getChallenge(self):
return self.challenges.pop()
def setResponse(self, response):
setattr(self, nativeString(self.responses.pop()), response)
def moreChallenges(self):
return bool(self.challenges)
@implementer(IChallengeResponse)
class PLAINCredentials(credentials.UsernamePassword):
def __init__(self):
credentials.UsernamePassword.__init__(self, None, None)
def getChallenge(self):
return b""
def setResponse(self, response):
parts = response.split(b"\0")
if len(parts) != 3:
raise IllegalClientResponse("Malformed Response - wrong number of parts")
useless, self.username, self.password = parts
def moreChallenges(self):
return False
__all__ = [
"CramMD5ClientAuthenticator",
"LOGINCredentials",
"LOGINAuthenticator",
"PLAINCredentials",
"PLAINAuthenticator",
]
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| newsfragments | Folder | 0755 |
|
|
| scripts | Folder | 0755 |
|
|
| test | Folder | 0755 |
|
|
| __init__.py | File | 142 B | 0644 |
|
| _cred.py | File | 2.68 KB | 0644 |
|
| _except.py | File | 8.49 KB | 0644 |
|
| _pop3client.py | File | 45.64 KB | 0644 |
|
| alias.py | File | 23.43 KB | 0644 |
|
| bounce.py | File | 3.1 KB | 0644 |
|
| imap4.py | File | 206.47 KB | 0644 |
|
| interfaces.py | File | 31.32 KB | 0644 |
|
| mail.py | File | 20.09 KB | 0644 |
|
| maildir.py | File | 27.07 KB | 0644 |
|
| pb.py | File | 3.62 KB | 0644 |
|
| pop3.py | File | 53.6 KB | 0644 |
|
| pop3client.py | File | 487 B | 0644 |
|
| protocols.py | File | 12.04 KB | 0644 |
|
| relay.py | File | 5.14 KB | 0644 |
|
| relaymanager.py | File | 37.6 KB | 0644 |
|
| smtp.py | File | 70.6 KB | 0644 |
|
| tap.py | File | 12.5 KB | 0644 |
|