Exemplo n.º 1
0
 def __init__(self, clientSocket, serverName, serverPort, spam, unsure):
     POP3ProxyBase.__init__(self, clientSocket, serverName, serverPort)
     self.handlers = {'RETR': self.onRetr}
     state.totalSessions += 1
     state.activeSessions += 1
     self.isClosed = False
     self.spam_folder = spam
     self.unsure_folder = unsure
Exemplo n.º 2
0
 def __init__(self, clientSocket, serverName, serverPort, spam, unsure):
     POP3ProxyBase.__init__(self, clientSocket, serverName, serverPort)
     self.handlers = {'RETR': self.onRetr}
     state.totalSessions += 1
     state.activeSessions += 1
     self.isClosed = False
     self.spam_folder = spam
     self.unsure_folder = unsure
Exemplo n.º 3
0
 def close(self):

        if not self.isClosed:

            self.isClosed = True

            state.activeSessions -= 1

            POP3ProxyBase.close(self)
Exemplo n.º 4
0
 def recv(self, size):
     """Logs the data to the log file."""
     data = POP3ProxyBase.recv(self, size)
     if options["globals", "verbose"]:
         state.logFile.write(data)
         state.logFile.flush()
     return data
Exemplo n.º 5
0
 def recv(self, size):
     """Logs the data to the log file."""
     data = POP3ProxyBase.recv(self, size)
     if options["globals", "verbose"]:
         state.logFile.write(data)
         state.logFile.flush()
     return data
Exemplo n.º 6
0
 def send(self, data):
     """Logs the data to the log file."""
     if options["globals", "verbose"]:
         state.logFile.write(data)
         state.logFile.flush()
     try:
         return POP3ProxyBase.send(self, data)
     except socket.error:
         self.close()
Exemplo n.º 7
0
 def send(self, data):
     """Logs the data to the log file."""
     if options["globals", "verbose"]:
         state.logFile.write(data)
         state.logFile.flush()
     try:
         return POP3ProxyBase.send(self, data)
     except socket.error:
         self.close()
Exemplo n.º 8
0
 def close(self):
     # This can be called multiple times by async.
     if not self.isClosed:
         self.isClosed = True
         state.activeSessions -= 1
         POP3ProxyBase.close(self)
Exemplo n.º 9
0
 def close(self):
     # This can be called multiple times by async.
     if not self.isClosed:
         self.isClosed = True
         state.activeSessions -= 1
         POP3ProxyBase.close(self)
Exemplo n.º 10
0
class  RedirectingBayesProxy (POP3ProxyBase) :
	"""Proxies between an email client and a POP3 server, redirecting
    mail to the imap server as necessary.  It acts on the following
    POP3 commands:
     o RETR:
        o Adds the judgement header based on the raw headers and body
          of the message.
    """
	    intercept_message = 'From: "Spambayes" <*****@*****.**>\r\n' \
                        'Subject: Spambayes Intercept\r\n\r\nA message ' \
                        'was intercepted by Spambayes (it scored %s).\r\n' \
                        '\r\nYou may find it in the Spam or Unsure ' \
                        'folder.\r\n\r\n'
	    def __init__(self, clientSocket, serverName, serverPort, spam, unsure):

        POP3ProxyBase.__init__(self, clientSocket, serverName, serverPort)

        self.handlers = {'RETR': self.onRetr}

        state.totalSessions += 1

        state.activeSessions += 1

        self.isClosed = False

        self.spam_folder = spam

        self.unsure_folder = unsure
 def send(self, data):

        """Logs the data to the log file."""