From owner-freebsd-questions@FreeBSD.ORG Tue Jan 9 12:59:55 2007 Return-Path: X-Original-To: FreeBSD-questions@freebsd.org Delivered-To: FreeBSD-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E42DA16A417 for ; Tue, 9 Jan 2007 12:59:55 +0000 (UTC) (envelope-from jhary@unsane.co.uk) Received: from unsane.co.uk (www.unsane.co.uk [85.233.185.162]) by mx1.freebsd.org (Postfix) with ESMTP id 72E2913C478 for ; Tue, 9 Jan 2007 12:59:54 +0000 (UTC) (envelope-from jhary@unsane.co.uk) Received: from [195.72.130.92] (195-72-130-92.wifi.datahop.it [195.72.130.92]) (authenticated bits=0) by unsane.co.uk (8.13.8/8.13.8) with ESMTP id l09D045O022362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Jan 2007 13:00:04 GMT (envelope-from jhary@unsane.co.uk) Message-ID: <45A391C6.5060403@unsane.co.uk> Date: Tue, 09 Jan 2007 12:59:50 +0000 From: Vince User-Agent: Thunderbird 1.5.0.8 (X11/20061204) MIME-Version: 1.0 To: linux quest References: <20070109081748.27320.qmail@web59210.mail.re1.yahoo.com> In-Reply-To: <20070109081748.27320.qmail@web59210.mail.re1.yahoo.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD-questions@freebsd.org Subject: Re: Nmap Scan from FreeBSD OS - Coding Question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2007 12:59:56 -0000 linux quest wrote: > I am currently doing a simple penetration testing for my company in a LAN environment. Yes, I have already downloaded NMap by using the 'make install' command... and it did fetched the required files from insecure.org successfully. > > My question will be, how can I create a Network Program in .c that will invoke the nmap capabilities to scan the network or computers? Example, lets say, I want an automated nmap scan to run on FreeBSD to scan 192.168.1.10 and 192.168.1.11 , every morning at 10am - may I know how do I achieve that? I hope someone can show me a simple coding to invoke nmap scan, thanks :) > you dont really need c for this, a simple shell script run from cron would do fine. something like ===========start============== #!/bin/sh TARGETS="192.168.1.10 192.168.1.11" NMAP="/usr/local/bin/nmap" NMAPOPTIONS="" RECEPIENTS="someone@somewhere.com" SUBJECT="namp scan results" $NMAP $NMAPOPTIONS $TARGETS | /usr/bin/mail -s "$SUBJECT" $RECEPIENTS ===========end================= save that somewhere and remember to chmod it to be executable add a line like 1 10 * * * /path/to/script to the appropriate users crontab (change /path/to/script to the location of the script) and you should get the output emailed to you every morning. Vince > Thanks :) > > Regards, > Linux Quest > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"