Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | set_debuglevel |
def | connect |
def | send |
def | putcmd |
def | getreply |
def | docmd |
def | helo |
def | ehlo |
def | has_extn |
def | help |
def | rset |
def | noop |
def | |
def | rcpt |
def | data |
def | verify |
def | expn |
def | login |
def | starttls |
def | sendmail |
def | close |
def | quit |
Data Fields | |
esmtp_features | |
debuglevel | |
sock | |
does_esmtp | |
Static Public Attributes | |
int | debuglevel = 0 |
file = None | |
helo_resp = None | |
ehlo_resp = None | |
int | does_esmtp = 0 |
vrfy = verify | |
This class manages a connection to an SMTP or ESMTP server. SMTP Objects: SMTP objects have the following attributes: helo_resp This is the message given by the server in response to the most recent HELO command. ehlo_resp This is the message given by the server in response to the most recent EHLO command. This is usually multiline. does_esmtp This is a True value _after you do an EHLO command_, if the server supports ESMTP. esmtp_features This is a dictionary, which, if the server supports ESMTP, will _after you do an EHLO command_, contain the names of the SMTP service extensions this server supports, and their parameters (if any). Note, all extension names are mapped to lower case in the dictionary. See each method's docstrings for details. In general, there is a method of the same name to perform each SMTP command. There is also a method called 'sendmail' that will do an entire mail transaction.
Definition at line 188 of file smtplib.py.
def __init__ | ( | self, | |
host = '' , |
|||
port = 0 |
|||
) |
Initialize a new instance. If specified, `host' is the name of the remote host to which to connect. If specified, `port' specifies the port to which to connect. By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly.
Definition at line 223 of file smtplib.py.
def close | ( | self) |
Close the connection to the SMTP server.
Definition at line 657 of file smtplib.py.
References Chunk.file, POP3.file, FTP.file, NNTP.file, Class.file, Hook.file, SMTP.file, DumbWriter.file, MiniFieldStorage.file, Breakpoint.file, FieldStorage.file, HTTP.file, POP3.sock, FTP.sock, NNTP.sock, SMTP.sock, HTTPConnection.sock, and HTTPSConnection.sock.
def connect | ( | self, | |
host = 'localhost' , |
|||
port = 0 |
|||
) |
Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This method is automatically invoked by __init__, if a host is specified during instantiation.
Definition at line 247 of file smtplib.py.
References HTTPResponse.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, and HTTP.debuglevel.
def data | ( | self, | |
msg | |||
) |
SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. Raises SMTPDataError if there is an unexpected reply to the DATA command; the return value from this method is the final response code received when the all data is sent.
Definition at line 433 of file smtplib.py.
References HTTPResponse.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, HTTP.debuglevel, SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), SMTP.putcmd(), smtplib.quotedata(), SSLFakeSocket.send(), SMTP.send(), HTTPConnection.send(), dispatcher_with_send.send(), file_wrapper.send(), FakeSocket.send(), and HTTP.send.
def docmd | ( | self, | |
cmd, | |||
args = "" |
|||
) |
Send a command, and return its response code.
Definition at line 348 of file smtplib.py.
References SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), and SMTP.putcmd().
def ehlo | ( | self, | |
name = '' |
|||
) |
SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host.
Definition at line 367 of file smtplib.py.
References FileWrapper.close(), Shelf.close(), Chunk.close(), _Subfile.close(), SGMLParser.close(), openrsrc.close(), SSLFakeSocket.close(), _Hqxcoderengine.close(), SSLFakeFile.close(), FileInput.close(), _Rlecoderengine.close(), HTTPResponse.close(), BinHex.close(), GzipFile.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HTTPConnection.close(), HexBin.close(), TestSGMLParser.close(), file_wrapper.close(), FTP.close(), SMTP.close(), HTTP.close(), SMTP.ehlo_resp, SMTP.esmtp_features, socket.getfqdn(), SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), and SMTP.putcmd().
def expn | ( | self, | |
address | |||
) |
SMTP 'verify' command -- checks for address validity.
Definition at line 463 of file smtplib.py.
References SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), SMTP.putcmd(), and smtplib.quoteaddr().
def getreply | ( | self) |
Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (multiline responses are converted to a single, multiline string). Raises SMTPServerDisconnected if end-of-file is reached.
Definition at line 308 of file smtplib.py.
References FileWrapper.close(), Shelf.close(), Chunk.close(), _Subfile.close(), SGMLParser.close(), openrsrc.close(), SSLFakeSocket.close(), _Hqxcoderengine.close(), SSLFakeFile.close(), FileInput.close(), _Rlecoderengine.close(), HTTPResponse.close(), BinHex.close(), GzipFile.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HTTPConnection.close(), HexBin.close(), TestSGMLParser.close(), file_wrapper.close(), FTP.close(), SMTP.close(), HTTP.close(), HTTPResponse.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, HTTP.debuglevel, Chunk.file, POP3.file, FTP.file, NNTP.file, Class.file, Hook.file, SMTP.file, DumbWriter.file, MiniFieldStorage.file, Breakpoint.file, FieldStorage.file, HTTP.file, dospath.join(), and string.strip().
def has_extn | ( | self, | |
opt | |||
) |
Does the server support a given SMTP service extension?
Definition at line 399 of file smtplib.py.
def helo | ( | self, | |
name = '' |
|||
) |
SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host.
Definition at line 354 of file smtplib.py.
References socket.getfqdn(), SMTP.getreply(), HTTP.getreply(), SMTP.helo_resp, FTP.putcmd(), NNTP.putcmd(), and SMTP.putcmd().
def help | ( | self, | |
args = '' |
|||
) |
SMTP 'help' command. Returns help text from server.
Definition at line 403 of file smtplib.py.
References SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), and SMTP.putcmd().
def login | ( | self, | |
user, | |||
password | |||
) |
Log in on an SMTP server that requires authentication. The arguments are: - user: The user name to authenticate with. - password: The password for the authentication. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method will return normally if the authentication was successful. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to the helo greeting. SMTPAuthenticationError The server didn't accept the username/ password combination. SMTPException No suitable authentication method was found.
Definition at line 470 of file smtplib.py.
References HTTPResponse.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, HTTP.debuglevel, base64.decodestring(), SMTP.docmd(), SMTP.ehlo(), SMTP.ehlo_resp, base64.encodestring(), SMTP.esmtp_features, SMTP.has_extn(), SMTP.helo(), SMTP.helo_resp, hmac.hexdigest(), and dospath.split().
def mail | ( | self, | |
sender, | |||
options = [] |
|||
) |
SMTP 'mail' command -- begins mail xfer session.
Definition at line 417 of file smtplib.py.
References SMTP.does_esmtp, SMTP.getreply(), HTTP.getreply(), dospath.join(), FTP.putcmd(), NNTP.putcmd(), SMTP.putcmd(), and smtplib.quoteaddr().
def noop | ( | self) |
SMTP 'noop' command -- doesn't do anything :>
Definition at line 413 of file smtplib.py.
References SMTP.docmd().
def putcmd | ( | self, | |
cmd, | |||
args = "" |
|||
) |
Send a command to the server.
Definition at line 300 of file smtplib.py.
References SSLFakeSocket.send(), SMTP.send(), HTTPConnection.send(), dispatcher_with_send.send(), file_wrapper.send(), FakeSocket.send(), and HTTP.send.
def quit | ( | self) |
Terminate the SMTP session.
Definition at line 667 of file smtplib.py.
References FileWrapper.close(), Shelf.close(), Chunk.close(), _Subfile.close(), SGMLParser.close(), openrsrc.close(), SSLFakeSocket.close(), _Hqxcoderengine.close(), SSLFakeFile.close(), FileInput.close(), _Rlecoderengine.close(), HTTPResponse.close(), BinHex.close(), GzipFile.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HTTPConnection.close(), HexBin.close(), TestSGMLParser.close(), file_wrapper.close(), FTP.close(), SMTP.close(), HTTP.close(), and SMTP.docmd().
def rcpt | ( | self, | |
recip, | |||
options = [] |
|||
) |
SMTP 'rcpt' command -- indicates 1 recipient for this mail.
Definition at line 425 of file smtplib.py.
References SMTP.does_esmtp, SMTP.getreply(), HTTP.getreply(), dospath.join(), FTP.putcmd(), NNTP.putcmd(), SMTP.putcmd(), and smtplib.quoteaddr().
def rset | ( | self) |
SMTP 'rset' command -- resets session.
Definition at line 409 of file smtplib.py.
References SMTP.docmd().
def send | ( | self, | |
str | |||
) |
Send `str' to the server.
Definition at line 288 of file smtplib.py.
References FileWrapper.close(), Shelf.close(), Chunk.close(), _Subfile.close(), SGMLParser.close(), openrsrc.close(), SSLFakeSocket.close(), _Hqxcoderengine.close(), SSLFakeFile.close(), FileInput.close(), _Rlecoderengine.close(), HTTPResponse.close(), BinHex.close(), GzipFile.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HTTPConnection.close(), HexBin.close(), TestSGMLParser.close(), file_wrapper.close(), FTP.close(), SMTP.close(), HTTP.close(), HTTPResponse.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, HTTP.debuglevel, POP3.sock, FTP.sock, NNTP.sock, SMTP.sock, HTTPConnection.sock, and HTTPSConnection.sock.
def sendmail | ( | self, | |
from_addr, | |||
to_addrs, | |||
msg, | |||
mail_options = [] , |
|||
rcpt_options = [] |
|||
) |
This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : A list of addresses to send this mail to. A bare string will be treated as a list with 1 address. - msg : The message to send. - mail_options : List of ESMTP options (such as 8bitmime) for the mail command. - rcpt_options : List of ESMTP options (such as DSN commands) for all the rcpt commands. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size and each of the specified options will be passed to it. If EHLO fails, HELO will be tried and ESMTP options suppressed. This method will return normally if the mail is accepted for at least one recipient. It returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to the helo greeting. SMTPRecipientsRefused The server rejected ALL recipients (no mail was sent). SMTPSenderRefused The server didn't accept the from_addr. SMTPDataError The server replied with an unexpected error code (other than a refusal of a recipient). Note: the connection will be open even after an exception is raised. Example: >>> import smtplib >>> s=smtplib.SMTP("localhost") >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"] >>> msg = ''' ... From: Me@my.org ... Subject: testin'... ... ... This is a test ''' >>> s.sendmail("me@my.org",tolist,msg) { "three@three.org" : ( 550 ,"User unknown" ) } >>> s.quit() In the above example, the message was accepted for delivery to three of the four addresses, and one was rejected, with the error code 550. If all addresses are accepted, then the method will return an empty dictionary.
Definition at line 564 of file smtplib.py.
References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, WeakKeyDictionary.data, MutableString.data, _Rlecoderengine.data, Request.data, simple_producer.data, Binary.data, NewsManager.data, _Environ.data, Marshaller.data, SMTP.data(), FormContentDict.data, GUISimpleListPicker.listitem.data, SMTP.does_esmtp, SMTP.ehlo(), SMTP.ehlo_resp, SMTP.has_extn(), SMTP.helo(), SMTP.helo_resp, SMTP.mail(), SMTP.rcpt(), POP3.rset(), and SMTP.rset().
def set_debuglevel | ( | self, | |
debuglevel | |||
) |
Set the debug output level. A non-false value results in debug messages for connection and for all messages sent to and received from the server.
Definition at line 238 of file smtplib.py.
def starttls | ( | self, | |
keyfile = None , |
|||
certfile = None |
|||
) |
Puts the connection to the SMTP server into TLS mode. If the server supports TLS, this will encrypt the rest of the SMTP session. If you provide the keyfile and certfile parameters, the identity of the SMTP server and client can be checked. This, however, depends on whether the socket module really checks the certificates.
Definition at line 547 of file smtplib.py.
References SMTP.docmd(), Chunk.file, POP3.file, FTP.file, NNTP.file, Class.file, Hook.file, SMTP.file, DumbWriter.file, MiniFieldStorage.file, Breakpoint.file, FieldStorage.file, HTTP.file, SMTP.sendmail(), POP3.sock, FTP.sock, NNTP.sock, SMTP.sock, HTTPConnection.sock, HTTPSConnection.sock, and socket.ssl().
def verify | ( | self, | |
address | |||
) |
SMTP 'verify' command -- checks for address validity.
Definition at line 456 of file smtplib.py.
References SMTP.getreply(), HTTP.getreply(), FTP.putcmd(), NNTP.putcmd(), SMTP.putcmd(), and smtplib.quoteaddr().
|
static |
Definition at line 217 of file smtplib.py.
debuglevel |
Definition at line 245 of file smtplib.py.
|
static |
Definition at line 221 of file smtplib.py.
does_esmtp |
Definition at line 387 of file smtplib.py.
|
static |
Definition at line 220 of file smtplib.py.
esmtp_features |
Definition at line 232 of file smtplib.py.
|
static |
Definition at line 218 of file smtplib.py.
|
static |
Definition at line 219 of file smtplib.py.
sock |
Definition at line 268 of file smtplib.py.
|
static |
Definition at line 461 of file smtplib.py.