Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

intercepting smtp email

4 views
Skip to first unread message

Scott Hathaway

unread,
Sep 30, 2003, 9:18:48 AM9/30/03
to
I want to write an NT service that will intercept any outgoing smtp
traffic, like Norton Antivirus does. Can anyone tell me how I can do
something like this in Python? I do not know how to intercept the
outgoing traffic, specifically.

Any help is greatly appreciated.

Thanks,
Scott

.r!kard

unread,
Sep 30, 2003, 9:47:31 AM9/30/03
to
I'm no star at this but maybe you can check the code in
http://www.gnu.org/software/mailman

.r!kard

"Scott Hathaway" <sc...@hcsprogramming.com> wrote in message
news:c6354815.03093...@posting.google.com...

.r!kard

unread,
Sep 30, 2003, 9:51:48 AM9/30/03
to
Or maybe you can find it here: http://twistedmatrix.com

Basically i think you have to write your own SMTP-server if nobody else
hasn't done it already...

.r!kard


".r!kard" <rn...@algonet.se> wrote in message
news:blc1kt$ooe$1...@green.tninet.se...

.r!kard

unread,
Sep 30, 2003, 9:53:44 AM9/30/03
to
Even more results of Googeling:
http://www.vex.net/parnassus/apyllo.py?so=d&find=SMTP

.r!kard

".r!kard" <rn...@algonet.se> wrote in message

news:blc1ss$p54$1...@green.tninet.se...

John Roth

unread,
Sep 30, 2003, 10:59:37 AM9/30/03
to

".r!kard" <rn...@algonet.se> wrote in message
news:blc1kt$ooe$1...@green.tninet.se...
> I'm no star at this but maybe you can check the code in
> http://www.gnu.org/software/mailman
>
> .r!kard

I think he's asking for a mini-firewall. In other words, is something
he doesn't know about sending messages on port 25?

John Roth

.r!kard

unread,
Sep 30, 2003, 11:09:47 AM9/30/03
to
Now you got me corious, is that possible in python?
Possibly by extending it with som C of course...

.r!kard


"John Roth" <newsg...@jhrothjr.com> wrote in message
news:vnj6j3d...@news.supernews.com...

John Roth

unread,
Sep 30, 2003, 11:37:44 AM9/30/03
to

".r!kard" <rn...@algonet.se> wrote in message
news:blc6f3$3si$1...@green.tninet.se...

> Now you got me corious, is that possible in python?
> Possibly by extending it with som C of course...

I've got no idea where you would put that kind of hook
in Windows.

John Roth

Rudy Schockaert

unread,
Sep 30, 2003, 1:16:49 PM9/30/03
to
Woldn't this require something like winpcap? I know some folks have
attempted to call winpcap from within Python, but I don't know if they
succeeded. If my memory serves well, it was Gerhard Häring who did
something with it.

I would also be interested in something similar, but then for MSN
traffic. Decoding the MSN Messenger stream is not the problem, capturing
the traffic from a promiscous nic in Python is where I get stuck.

>>Now you got me corious, is that possible in python?
>>Possibly by extending it with som C of course...
>
>
> I've got no idea where you would put that kind of hook
> in Windows.
>
> John Roth

<snip>

.r!kard

unread,
Sep 30, 2003, 2:25:52 PM9/30/03
to
Google rules:
http://home.student.utwente.nl/g.v.berg/btk/
http://pycap.sourceforge.net
http://www.ghaering.de/python/unsupported/pylibpcap/
http://aspn.activestate.com/ASPN/Mail/Message/python-list/1578279

*pheew* that was some real hardcore Googeling I can tell you...

.r!kard


"Rudy Schockaert" <rudy.sc...@pandora.be> wrote in message
news:5Uieb.49566$Lw6.2...@phobos.telenet-ops.be...

Rudy Schockaert

unread,
Sep 30, 2003, 3:04:35 PM9/30/03
to
It seems you've looking where I've earlier this week ;-) I'm affraid
there's nothing for Python on Windows yet.

.r!kard wrote:

> Google rules:
> http://home.student.utwente.nl/g.v.berg/btk/

This one is for unices only, no Windows.

> http://pycap.sourceforge.net

From the Todo.txt file:

* Make this work on Windows. I briefly struggled with compiling using
VC7 under Win XP
using winpcap_ and LibnetNT_. No luck, and was getting some rather
interesting errors
about missing header files which appeared to be where they should be :-/.

> http://www.ghaering.de/python/unsupported/pylibpcap/

This could be a candidate if it were available for Python 2.3.x . It's
for Python 2.2 only now.

> http://aspn.activestate.com/ASPN/Mail/Message/python-list/1578279
Further down the thread:
http://aspn.activestate.com/ASPN/Mail/Message/python-list/1578500
Gerhard Häring wrote:
> http://www.ghaering.de/python/unsupported/pylibpcap/
> I'll check if the sniff.py example will work, too.

It doesn't look like it does. I may have introduced a subtle bug or some
more changes are needed to make it useful under win32.

If anybody wants to continue the win32 port, it's open source and you
can continue where I stopped.

-- Gerhard

Out of luck again :-(

>
> *pheew* that was some real hardcore Googeling I can tell you...
>
> .r!kard

>><snip>

Scott Hathaway

unread,
Sep 30, 2003, 5:04:19 PM9/30/03
to
Thanks for the suggestions. My second alternative is to simply use the api
in outlook and be bound to that client. Worse things have happened.

:)

Scott

"Rudy Schockaert" <rudy.sc...@pandora.be> wrote in message

news:7tkeb.49855$CW5.2...@phobos.telenet-ops.be...

Geoff Howland

unread,
Oct 1, 2003, 4:41:17 AM10/1/03
to
On Tue, 30 Sep 2003 19:04:35 GMT, Rudy Schockaert
<rudy.sc...@pandora.be> wrote:

http://winpcap.polito.it/

Grab SWIG and you can probably get something working in a few hours.
Last time I did this it took about 40 minutes to get working, and a
few hours to push it out so others could use it as well.

Extra bonus points for making it use either winpcap or libpcap
depending on the OS built on. ;)

-Geoff

>It seems you've looking where I've earlier this week ;-) I'm affraid
>there's nothing for Python on Windows yet.
>
>.r!kard wrote:
>
>> Google rules:
>> http://home.student.utwente.nl/g.v.berg/btk/
>
>This one is for unices only, no Windows.
>
>> http://pycap.sourceforge.net

-Geoff Howland
http://ludumdare.com/

Peter Hansen

unread,
Oct 1, 2003, 1:46:45 PM10/1/03
to
Scott Hathaway wrote:
>
> I want to write an NT service that will intercept any outgoing smtp
> traffic, like Norton Antivirus does. Can anyone tell me how I can do
> something like this in Python? I do not know how to intercept the
> outgoing traffic, specifically.

Normally a mail program does not connect directly to the receiving
server, but sends all mail via a "relay" server which talks SMTP.
For example, if you have an ISP connection, your mail would go through
their server, which would forward it to the appropriate final destination.

Why do you need to *intercept* SMTP traffic, when you could simply
modify the "outgoing server" setting for your mail program, and then
run a proxy SMTP server which would receive your mail, do the processing
you want, then forward the results to the original server?

-Peter

Pettersen, Bjorn S

unread,
Oct 1, 2003, 4:03:27 PM10/1/03
to
> From: Peter Hansen [mailto:pe...@engcorp.com]
>
> Scott Hathaway wrote:
> >
> > I want to write an NT service that will intercept any outgoing smtp
> > traffic, like Norton Antivirus does. Can anyone tell me
> > how I can do something like this in Python? I do not know
> > how to intercept the outgoing traffic, specifically.
>
> Normally a mail program does not connect directly to the receiving
> server, but sends all mail via a "relay" server which talks SMTP.
> For example, if you have an ISP connection, your mail would go through
> their server, which would forward it to the appropriate final
> destination.
[..]

Although some "programs" have their own embedded smtp servers that
attempt to connect directly to the recipients 'domain' before sending
its payload... A small service that could catch this use-case would be
useful for a number of friends of mine <wink/sigh>. (I think I know just
the way to distribute it to get maximum effect too <grin>).

just-barely-joking'ly
-- bjorn

0 new messages