<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Luca's forge &#187; Net_Nmap</title>
	<atom:link href="http://lucasforge.2bopen.org/category/net_nmap/feed/" rel="self" type="application/rss+xml" />
	<link>http://lucasforge.2bopen.org</link>
	<description>Experiments from the land of open source</description>
	<lastBuildDate>Tue, 20 Jul 2010 15:24:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Discovery hosts and services with PHP and Nmap</title>
		<link>http://lucasforge.2bopen.org/2008/06/discovery-hosts-and-services-with-php-and-nmap/</link>
		<comments>http://lucasforge.2bopen.org/2008/06/discovery-hosts-and-services-with-php-and-nmap/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 21:39:38 +0000</pubDate>
		<dc:creator>Luca Corbo</dc:creator>
				<category><![CDATA[Net_Nmap]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://lucasforge.2bopen.org/?p=8</guid>
		<description><![CDATA[Requirements: - PHP5 - PEAR::Net_Nmap - nmap &#60;?php /** * Scan network to retrieve hosts and services information. */ require_once &#039;Net/Nmap.php&#039;; //Define the target to scan $target = array(&#039;127.0.0.1&#039;,&#039;www.yourserver.com&#039;); $options = array(&#039;nmap_binary&#039; =&#62; &#039;/usr/local/bin/nmap&#039;); try { $nmap = new Net_Nmap($options); //Enable nmap options $nmap_options = array(&#039;os_detection&#039; =&#62; true, &#039;service_info&#039; =&#62; true, &#039;port_ranges&#039; =&#62; &#039;U:53,111,137,T:21-25,80,139,8080&#039;,//to scan [...]]]></description>
			<content:encoded><![CDATA[<p>Requirements:</p>
<p>- <a title="PHP.net" href="http://www.php.net" target="_blank">PHP5</a><br />
- <a title="Net_Nmap" href="http://pear.php.net/package/Net_Nmap" target="_self">PEAR::Net_Nmap</a><br />
- <a title="nmap" href="http://nmap.org/" target="_blank">nmap</a></p>
<pre class="brush: php">
&lt;?php

/**
 * Scan network to retrieve hosts and services information.
 */

require_once &#039;Net/Nmap.php&#039;;

//Define the target to scan
$target = array(&#039;127.0.0.1&#039;,&#039;www.yourserver.com&#039;);

$options = array(&#039;nmap_binary&#039; =&gt; &#039;/usr/local/bin/nmap&#039;);

try {
    $nmap = new Net_Nmap($options);

    //Enable nmap options
    $nmap_options = array(&#039;os_detection&#039; =&gt; true,
                          &#039;service_info&#039; =&gt; true,
                          &#039;port_ranges&#039; =&gt; &#039;U:53,111,137,T:21-25,80,139,8080&#039;,//to scan only specified ports
                          );

    $nmap-&gt;enableOptions($nmap_options);

    //Scan target
    $res = $nmap-&gt;scan($target);

    //Get failed hosts
    $failed_to_resolve = $nmap-&gt;getFailedToResolveHosts();

    if (count($failed_to_resolve) &gt; 0) {
        echo &#039;Failed to resolve given hostname/IP: &#039; .
             implode (&#039;, &#039;, $failed_to_resolve) .
             &quot;\n&quot;;
    }

    //Parse XML Output to retrieve Hosts Object
    $hosts = $nmap-&gt;parseXMLOutput();

    //Print results
    foreach ($hosts as $key =&gt; $host) {
        echo &#039;Hostname: &#039; . $host-&gt;getHostname() . &quot;\n&quot;;
        echo &#039;Address: &#039; . $host-&gt;getAddress() . &quot;\n&quot;;
        echo &#039;OS: &#039; . $host-&gt;getOS() . &quot;\n&quot;;
        echo &#039;Status: &#039; . $host-&gt;getStatus . &quot;\n&quot;;
        $services = $host-&gt;getServices();
        echo &#039;Number of discovered services: &#039; . count($services) . &quot;\n&quot;;
        foreach ($services as $key =&gt; $service) {
            echo &quot;\n&quot;;
            echo &#039;Service Name: &#039; . $service-&gt;name . &quot;\n&quot;;
            echo &#039;Port: &#039; . $service-&gt;port . &quot;\n&quot;;
            echo &#039;Protocol: &#039; . $service-&gt;protocol . &quot;\n&quot;;
            echo &#039;Product information: &#039; . $service-&gt;product . &quot;\n&quot;;
            echo &#039;Product version: &#039; . $service-&gt;version . &quot;\n&quot;;
            echo &#039;Product additional info: &#039; . $service-&gt;extrainfo . &quot;\n&quot;;
        }
    }
} catch (Net_Nmap_Exception $ne) {
    echo $ne-&gt;getMessage();
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lucasforge.2bopen.org/2008/06/discovery-hosts-and-services-with-php-and-nmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Net_Nmap 1.0.0 beta1 released!</title>
		<link>http://lucasforge.2bopen.org/2008/05/net_nmap-100-beta1-released/</link>
		<comments>http://lucasforge.2bopen.org/2008/05/net_nmap-100-beta1-released/#comments</comments>
		<pubDate>Thu, 22 May 2008 22:11:38 +0000</pubDate>
		<dc:creator>Luca Corbo</dc:creator>
				<category><![CDATA[Net_Nmap]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lucasforge.2bopen.org/?p=5</guid>
		<description><![CDATA[The Net_Nmap Pear package is a simple interface for Nmap, the free and open source utility for network exploration or security auditing. Net_Nmap can be used to auto discovery hosts and services in your network or simply to parse Nmap XML output. You may install it on your system simply typing: $ pear install Net_Nmap [...]]]></description>
			<content:encoded><![CDATA[<p>The Net_Nmap <a title="Pear" href="http://pear.php.net" target="_blank">Pear</a> package is a simple interface for <a title="Nmap.org" href="http://nmap.org/">Nmap</a>, the free and open source utility for network exploration or security auditing.</p>
<p>Net_Nmap can be used to auto discovery hosts and services in your network or simply to parse Nmap XML output.</p>
<p>You may install it on your system simply typing:</p>
<pre>$ pear install Net_Nmap</pre>
<p>or if prefer <a title="Download Net_Nmap" href="http://pear.php.net/package/Net_Nmap/download" target="_blank">download it</a> from the Pear web site.</p>
]]></content:encoded>
			<wfw:commentRss>http://lucasforge.2bopen.org/2008/05/net_nmap-100-beta1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
