IP Math anyone?

Mark Pilgrim f8dy at yahoo.com
Tue Feb 27 20:35:32 CET 2001


"Jay O'Connor" <joconnor at cybermesa.com> wrote in message
news:3A9BEC42.5F9888 at cybermesa.com...
>
>
> Remco Gerlich wrote:
>
> > Erno Kuusela <erno-news at erno.iki.fi> wrote in comp.lang.python:
> > > In article <slrn99mnvn.ia7.scarblac at pino.selwerd.nl>,
> > > scarblac at pino.selwerd.nl (Remco Gerlich) writes:
> > >
> > > | .0.255 and .1.0 are not IP addresses you could give to a machine.
> > > | I've never seen existing code for this, seems to need some custom
hacking.
> > >
> > > | (I don't know if .255 and .0 are the only exceptions, probably not).
> > >
> > > why do you think .0 or .255 are not usable addresses?
> >
> > I was confused about netmasks. I didn't expect the Spanish Inquisition!
> >
>
> No one expects the Spanish Inquisition
>
>
>
> (How many other identical posts will there be ?)

The real question is, why hasn't anyone written a bot to automate this?

import nntplib
import time

def inquisitionBot(host, port=119, user=None, password=None,
starttime=None):
 if not starttime:
  starttime = time.localtime(time.time() - 60*60*24)
 s = nntplib.NNTP(host, port, user, password)
 try:
  resp, articles = s.newnews("comp.lang.python", \
           time.strftime("%y%m%d", starttime), \
           time.strftime("%H%M%S", starttime))
  for articleID in articles:
   resp, status, cmd, body = s.body(articleID)
   if [line for line in body if \
    line[:1]<>'>' and \
    line.lower().count("i didn't expect the spanish inquisition")]:
    # if I continue this someone might actually use it... :)
    pass
 finally:
  s.quit()

-M
You're smart; why haven't you learned Python yet?
http://diveintopython.org/






More information about the Python-list mailing list