473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

pop3proxy

Hello every body,

Here is a python newbie! I've choose it to make a pop3 proxy - I want to
filter content between a pop3 client and a pop3 server, and I have no
control on the server...
First, I wanted to do an non-filtering, just logging, mono-thread proxy
to make some test..
Based on the RFC 1939 (http://www.faqs.org/rfcs/rfc1939.html) (in
particular the item 5), I was expecting some output, but did not get it...
In fact, I expected to see the message, but I did not see it... only the
command to retrieve it. On the other hand, the message is well receipt
in my mail client.
An other point is that all this seems to work well with short messages,
but difficulties appear when messages go bigger. I think it is due to
the parameter of recv, but I don't know how to set it.
So here are my two questions:
1-why do not I see the message in my output, and how could I do to see
and handle it?
2-how should I set the parameter of recv to handle big messages?

Any help would we very appreciate.

Cheers,

Brokenclock

Here is the code:
import socket

LOCALHOST = '192.168.31.202' # This is me
REMOTEHOST = 'pop.fr.oleane.com' # The remote host
PORT = 110 # pop3 port
while 1:
SocketServer = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
SocketServer.bind((LOCALHOST, PORT))
SocketServer.listen(1)
Connexion2Client, ClientAddress = SocketServer.accept()
print '#', ClientAddress,' connected'
ClientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ClientSocket.connect((REMOTEHOST, PORT))
print '#', REMOTEHOST, ' connected'
while 1:
DataFromServer = ClientSocket.recv(5896230)
print REMOTEHOST,'> ',DataFromServer
Connexion2Client.send(DataFromServer)
DataFromClient = Connexion2Client.recv(5896230)
print ClientAddress,'> ',DataFromClient
if DataFromClient==" QUIT": print 'QUIT received from client'
ClientSocket.send(DataFromClient)
if not DataFromClient: break
ClientSocket.close()
Connexion2Client.close()eof

Here the output: C:/Python24/pythonw.exe -u "C:/Python24/Scripts/pop3proxy3.py"
# ('192.168.31.202', 2345) connected
# pop.fr.oleane.com connected
pop.fr.oleane.com > +OK pop1.clb.oleane.net POP3 Oleane Mail Server Ready

('192.168.31.202', 2345) > CAPA

pop.fr.oleane.com > +OK Capability list follows
TOP
USER
RESP-CODES
AUTH-RESP-CODE
PIPELINING
UIDL
IMPLEMENTATION omail-1.3.1
..

('192.168.31.202', 2345) > USER Mo*******@wincanto.fr.fto

pop.fr.oleane.com > +OK User name accepted, password please
Username

('192.168.31.202', 2345) > PASS password

pop.fr.oleane.com > +OK 1 messages (1631 octets)

('192.168.31.202', 2345) > STAT

pop.fr.oleane.com > +OK 1 1631

('192.168.31.202', 2345) > LIST

pop.fr.oleane.com > +OK 1 messages (1631 octets)
1 1631
..

('192.168.31.202', 2345) > UIDL

pop.fr.oleane.com > +OK Unique-ID listing follows
1 42762947a48018100000065f
..

('192.168.31.202', 2345) > RETR 1

pop.fr.oleane.com > +OK pop1.clb.oleane.net chpounz the connection.
Have a nice day!

('192.168.31.202', 2345) >eof

Jul 19 '05 #1
2 2490
In article <42*********************@news.free.fr>,
BrokenClock <br*********@free.fr> wrote:
Here is a python newbie! I've choose it to make a pop3 proxy - I want to
filter content between a pop3 client and a pop3 server, and I have no
control on the server...
First, I wanted to do an non-filtering, just logging, mono-thread proxy
to make some test..


Not directly helpong with your problem, but perhaps some example code
helps: the spambayes project contains a working pop3 proxy.

Just
Jul 19 '05 #2
Thank you! At a first glance, it seems to be very similar to what I
need. More to come when I go deeper...

Just a écrit :
In article <42*********************@news.free.fr>,
BrokenClock <br*********@free.fr> wrote:

Here is a python newbie! I've choose it to make a pop3 proxy - I want to
filter content between a pop3 client and a pop3 server, and I have no
control on the server...
First, I wanted to do an non-filtering, just logging, mono-thread proxy
to make some test..

Not directly helpong with your problem, but perhaps some example code
helps: the spambayes project contains a working pop3 proxy.

Just

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paolo Invernizzi | last post by:
Spambayes CVS, Python 2.2.3, FreeBSD 5.1 On my machine I'm lunching the pop3proxy with cron at startup, and all is fine. But... sometimes during startup, or after a one or two days, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.