LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   A script to check ports of a long range of IPs (https://www.linuxquestions.org/questions/linux-networking-3/a-script-to-check-ports-of-a-long-range-of-ips-738007/)

tirengarfio 07-06-2009 04:43 AM

A script to check ports of a long range of IPs
 
Hi,

i want to create a script that will check the ports of a range of IPs.

I could write all the IPs, but i have thought there is maybe a way to write the rage instead of all the IPs.

Is that true?

Do you advice any language to write this kind of scripts?

Çiao

repo 07-06-2009 04:58 AM

Hi,

You could use nmap
Code:

nmap -p 80,22 10.0.0.0/24

tirengarfio 07-06-2009 05:11 AM

Thanks!,

the next question im wondering is:

If i get this result,

Starting Nmap 4.76 ( http://nmap.org ) at 2009-07-06 11:57 CEST
Interesting ports on localhost (127.0.0.1):
PORT STATE SERVICE
80/tcp closed http


then, I would like to write in a log file:

127.0.0.1: 80 CLOSED

How would you do that?

Ciao

nowonmai 07-06-2009 10:48 AM

nmap A.B.C.D/X -oN <logfile>

or

nmap A.B.C.D/X -oG <logfile>


All times are GMT -5. The time now is 06:45 PM.