Re: Collecting IP range
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Collecting IP range

From: David Murmann <david.murmann@rwth-aachen.de>
Date: Tue Jan 31 2006 - 05:33:06 CET

yawgmoth7 schrieb:
> Hello, I'm sure that this has been discussed before, but I have a
> question. I have written a few port scanners, banner grabbers in the
> past and have never found a good way to get a range of IP's.
> Obviously, in my opinion the best and simplest way to do somethign
> like and simple port scanner is to do something like:
>
> <code>
> for ips in range(startip,endip):
> <do blah>
>

you might want to take a look at IPy:

  http://c0re.23.nu/c0de/IPy/

iterating over ip-address ranges is very easy there:

>>> ip = IP('127.0.0.0/30')
>>> for x in ip:
      ... print x
      ...
      127.0.0.0
      127.0.0.1
      127.0.0.2
      127.0.0.3

--
David.
Received on Tue Feb 7 20:18:54 2006