.

IP conversion tool

<<

alucian

User avatar

Full Member
Full Member

Posts: 228

Joined: Mon Dec 29, 2008 2:01 pm

Location: Montreal, Canada

Post Tue Nov 30, 2010 11:54 am

IP conversion tool

Hello guys,

I need a tool that will transform and IP range to a list of IP's, that I will be able to put in an txt file.

As an example I have this range:

10.15.1-30,26,37,44-50.1-20

and I need a text file that will contain all the IPs in this range. I will use this file in Nessus to scan large parts of my network. I cannot put this range in Nessus because it doesn't recognize it. I can put it in Nmap, and I tried to do a ping scan against a range like this, but nmap has crashed.

(
Nmap scan report for 172.15.30.1
Host is up (0.0013s latency).
Nmap scan report for 172.15.30.2
Host is up (0.0014s latency).
Nmap scan report for 172.15.30.3
Host is up (0.00037s latency).


pcap_open_live(eth3, 100, 0, 200) FAILED. Reported error: eth3: That device is not up.  Will wait 5 seconds then retry.
pcap_open_live(eth3, 100, 0, 200) FAILED. Reported error: eth3: That device is not up.  Will wait 25 seconds then retry.
Call to pcap_open_live(eth3, 100, 0, 200) failed three times. Reported error: eth3: That device is not up
There are several possible reasons for this, depending on your operating system:
LINUX: If you are getting Socket type not supported, try modprobe af_packet or recompile your kernel with SOCK_PACKET enabled.
*BSD:  If you are getting device not configured, you need to recompile your kernel with Berkeley Packet Filter support.  If you are getting No such file or directory, try creating the device (eg cd /dev; MAKEDEV <device>; or use mknod).
*WINDOWS:  Nmap only supports ethernet interfaces on Windows for most operations because Microsoft disabled raw sockets as of Windows XP SP2.  Depending on the reason for this error, it is possible that the --unprivileged command-line argument will help.
SOLARIS:  If you are trying to scan localhost or the address of an interface and are getting '/dev/lo0: No such file or directory' or 'lo0: No DLPI device found', complain to Sun.  I don't think Solaris can support advanced localhost scans.  You can probably use "-PN -sT localhost" though.


QUITTING!

)

Thanks!
CISSP ISSAP, CISM/A, GWAPT, GCIH, GREM, GMOB, OSWP
<<

hayabusa

User avatar

Hero Member
Hero Member

Posts: 1662

Joined: Mon Jan 29, 2007 2:59 pm

Post Tue Nov 30, 2010 12:07 pm

Re: IP conversion tool

Can't just write a bash script or batch file to do it?
~ hayabusa ~ 

"All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved." - Sun Tzu, 'The Art of War'


OSCE, OSCP , GPEN, C|EH
<<

ziggy_567

User avatar

Sr. Member
Sr. Member

Posts: 378

Joined: Tue Dec 30, 2008 1:53 pm

Post Tue Nov 30, 2010 12:14 pm

Re: IP conversion tool

You can use a nested for loop to accomplish this.

Or, since you're really only talking about a few iterations a single for loop can be used and just edit it for each third octet needed.

Its not elegant, but it will do the trick...

Something along the lines of:

#!/bin/bash

for i in `seq 1 20`
do
  echo 10.15.1.$i >> iplist
done
--
Ziggy


eCPPT - GSEC - GCIH - GWAPT - GCUX - RHCE - SCSecA - Security+ - Network+
<<

hayabusa

User avatar

Hero Member
Hero Member

Posts: 1662

Joined: Mon Jan 29, 2007 2:59 pm

Post Tue Nov 30, 2010 12:33 pm

Re: IP conversion tool

Assuming I read your first post correctly, for what you want, this'll do it completely:

#!/bin/bash

for i in {1..30} 36 37 {44..50}
do
for p in {1..20}
do
       echo 10.15.$i.$p >>ips.txt
done
done
Last edited by hayabusa on Tue Nov 30, 2010 12:35 pm, edited 1 time in total.
~ hayabusa ~ 

"All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved." - Sun Tzu, 'The Art of War'


OSCE, OSCP , GPEN, C|EH
<<

alucian

User avatar

Full Member
Full Member

Posts: 228

Joined: Mon Dec 29, 2008 2:01 pm

Location: Montreal, Canada

Post Tue Nov 30, 2010 3:13 pm

Re: IP conversion tool

Thank you!

I will use for the moment that example, and I wil try to make it as simple as possible for some coleagues of mine that are not technical at all.

Our boss likes that everybody be able to use the tools, so I have to keep it as simple as possible.
CISSP ISSAP, CISM/A, GWAPT, GCIH, GREM, GMOB, OSWP
<<

hayabusa

User avatar

Hero Member
Hero Member

Posts: 1662

Joined: Mon Jan 29, 2007 2:59 pm

Post Tue Nov 30, 2010 3:38 pm

Re: IP conversion tool

Glad it helps.  I suppose, you could have it prompt for ranges, etc, with some tweaking, but I figured I'd give you the basics, to accomplish what you asked for, and you can build on it, from there.

Good luck with satisfying your boss(es).  ;)
~ hayabusa ~ 

"All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved." - Sun Tzu, 'The Art of War'


OSCE, OSCP , GPEN, C|EH

Return to Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron
.
Powered by phpBB® Forum Software © phpBB Group.
Designed by ST Software