For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > sending a scan result with perl by mail version 2....









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sending a scan result with perl by mail version 2....
juanbabi@gmail.com

2005-10-31, 9:55 pm

HI,

I am trying to write a script which will scan one of my machines for
open ports and send me the result by mail using qmail.also I want this
script to check if the there are more then 3 port open and if so just
than send me a mail.
this is a regular nmap scan on my pc:

Starting nmap 3.48 ( http://www.insecure.org/nmap/ ) at 2005-10-31
22:15 EET
Interesting ports on 192.168.1.1:
(The 1021 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
21/tcp open ftp
23/tcp open telnet
80/tcp open http

Nmap run completed -- 1 IP address (1 host up) scanned in 6.413 seconds



this is the script I wrote ( im really new in perl..),

#!/usr/bin/perl
#use strict;
use warnings;
my $nmap_result = `/usr/bin/nmap -p 1-1024 192.168.1.1`;

This is the end of the script.

I can send mail with this command:

/bin/mail -s "nmap result" juanbabi@gmail.com

How I combine those 2 things toughther and add that the mail should
send only if more then 3 ports are opened?

tahnks very very much !!



please help!

Juan

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com