apache - Error using PHP PEAR XAMPP 7.0.2.1 Net_Nmap -


i'm trying pear net_nmap package here:
https://pear.php.net/package/net_nmap/

i have nmap installed on windows 10 machine. found following code should job. there should configure before use pear?

i'm getting 2 errors:

warning: require_once(xml/parser.php): failed open stream: no such file or directory in c:\xampp\htdocs\net_nmap-master\net\nmap\parser.php on line 31

fatal error: require_once(): failed opening required 'xml/parser.php' (include_path='c:\xampp\php\pear') in c:\xampp\htdocs\net_nmap-master\net\nmap\parser.php on line 31

<?php // scan network retrieve hosts , services information. require_once 'net/nmap.php';  //define target , options $target = array('193.95.13.16','www.google.com'); $options = array('nmap_binary' => 'c:\program files (x86)\nmap');  try {     $nmap = new net_nmap($options);     $nmap_options = array(         'os_detection' => true,         'service_info' => true,         'port_ranges' => 'u:53,111,137,t:21-25,80,139,8080',      //           specified    ports     );     $nmap->enableoptions($nmap_options);      // scan     $res = $nmap->scan($target);      // failed hosts     $failed_to_resolve = $nmap->getfailedtoresolvehosts();     if (count($failed_to_resolve) > 0) {         echo 'failed resolve given hostname/ip: ' .              implode (', ', $failed_to_resolve) .              "\n";     }      //parse xml output retrieve hosts object     $hosts = $nmap->parsexmloutput();      //print results     foreach ($hosts $key => $host) {         echo 'hostname: ' . $host->gethostname() . "\n";         echo 'address: ' . $host->getaddress() . "\n";         echo 'os: ' . $host->getos() . "\n";         echo 'status: ' . $host->getstatus . "\n";         $services = $host->getservices();         echo 'number of discovered services: ' . count($services) . "\n";         foreach ($services $key => $service) {             echo "\n";             echo 'service name: ' . $service->name . "\n";             echo 'port: ' . $service->port . "\n";             echo 'protocol: ' . $service->protocol . "\n";             echo 'product information: ' . $service->product . "\n";             echo 'product version: ' . $service->version . "\n";             echo 'product additional info: ' . $service->extrainfo . "\n";         }     } }  catch (net_nmap_exception $ne) {     echo $ne->getmessage(); } ?> 

you did not use pear installer install net_nmap package, downloaded .tgz file , extracted it.

now missing dependencies listed on bottom left of net_nmap page. install them.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -