473,322 Members | 1,496 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,322 software developers and data experts.

Collecting IP range

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>

Well, since range() won't take a normal IP(Such as 127.0.0.1). and,
you can't take it as 127001(Since socket.connect() won't take that).
What would you suggest as a better way to approach this?

Thanks for all your help.
----------------------------
gurusnetwork.org
Gurus'Network - Are you a guru?

http://www.12dailypro.com/?ref=288444
Jan 31 '06 #1
3 1506
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.
Jan 31 '06 #2
yawgmoth7 schrieb:
Well, I seem to have a bit of a problem:
import IPy
ip =IP('127.0.0.1/30') Traceback (Most recent call last):
File "<stdin>". line `, in ?
NameError: name 'IP' is not defined

to make this work with "import IPy" you need
to use "ip = IPy.IP('127.0.0.1/30')".
I've tried doing it like:
from IPy import *
And then doing that, but it gives mea different error. Thanks once again


what error are you getting? it works for me...

--
David.
Jan 31 '06 #3
yawgmoth7 wrote:
Well, since range() won't take a normal IP(Such as 127.0.0.1). and,
you can't take it as 127001(Since socket.connect() won't take that).
What would you suggest as a better way to approach this?


Use a recipe for that. Have a look at:

http://aspn.activestate.com/ASPN/Coo.../Recipe/466286
and
http://aspn.activestate.com/ASPN/Coo.../Recipe/466298

--- Heiko Wundram.
Jan 31 '06 #4

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

Similar topics

2
by: serge calderara | last post by:
dear all, I am building an application which is collecting data from a database and display them in a windows form. My idea is to collect those data in a form that, they can be read by my...
10
by: Robert Potthast | last post by:
Hi! I am trying to implement a safe garbage collecting system. I use reference counting combined with smart pointers and a garbage collector which keeps a list of all heap-allocated objects. Now I...
2
by: David | last post by:
Sorry about the previous question. The thing I am really trying to do is collecting HTML id's on a given form. As you may know, ASP.NET control ids do not necessarily match html control names...
12
by: pmclinn | last post by:
How would you access a cookie value from a windowsform? This is how I do it from asp.net: If Not Request.Cookies("RunNodeReport") Is Nothing Then ...
0
by: Antal Rutz | last post by:
Hi all, I'd like to collect snmp data from varoius network devices parallel. First I tried with my own threadpool class then I gave a try to Christopher Arndt's threadpool.py...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
5
by: Phil | last post by:
What methods do we have of collecting information about browsing history? We would like to see the last few links that a client followed, prior to entering our site. I thought $_SERVER object...
3
by: meromake | last post by:
hello how collecting 1 + TW000001 To Get TW000002 Or 300 + TW000200 To Get TW000500 What ever i need this code
1
by: Bob Alston | last post by:
Looking for design approach ideas for collecting data from multiple remote, standalone databases. I have built one of these in Access. Another I am told was built in Access. some others the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.