os detcetion on RHEL 6

Bug #1171353 reported by Frank
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OCS Inventory: Server
New
Low
mortheres

Bug Description

http://forums.ocsinventory-ng.org/viewtopic.php?pid=55811#p55811

Content of the patch:
--- ipdiscover-util.pl.orig 2013-04-17 09:17:42.802572461 -0700
+++ ipdiscover-util.pl 2013-04-17 10:35:54.546572082 -0700
@@ -557,14 +557,15 @@
   open NMAP, "+>$path/$filter.gnmap";
   unless(flock(NMAP, LOCK_EX|LOCK_NB)){
       if($xml){
- print "<ERROR><MESSAGE>345</MESSAGE></ERROR>";
+ print "<ERROR><MESSAGE>347</MESSAGE></ERROR>";
  exit(0);
       }else{
         die "An other analyse is in progress\n";
       }
     }
   #Analyse
- system("nmap -R -v @ips -p 135,80,22,23 -oG $path/$filter.gnmap -P0 > /dev/null");
+ #system("nmap -R -v @ips -p 135,80,22,23 -oG $path/$filter.gnmap -P0 -O > /dev/null");
+ system("nmap -R -v @ips -p 135,80,22,23 -oG $path/$filter.gnmap -O > /dev/null");
   #
   my @gnmap;
   if($net){
@@ -580,7 +581,30 @@
     for $ref (@hosts){
       $h = $$ref[1];
          for(@gnmap){
+ next if /^#/; # Skip comments
     if(/Host: $h\b/){
+print "DEBUG: $h: $_\n";
+ if (/Status: Down/){
+ $PH[$j] = $ref;
+ $j++;
+ next REF;
+ }elsif(/Status: /){ # status up is meaningless to us
+ next;
+ }
+ # Try OS detection first
+ if(/OS: .*Windows/){
+ $PCW[$w] = $ref;
+ $w++;
+ next REF;
+ }elsif(/OS: .*Linux/ and !/OS: .*embedded/){
+ $PCL[$l] = $ref;
+ $l++;
+ next REF;
+ }elsif(/OS: /){ # Something else, call it network
+ $PR[$r] = $ref;
+ $r++;
+ next REF;
+ }
       if(/135\/o/){
                $PCW[$w] = $ref;
         $w++;
@@ -590,10 +614,11 @@
         $r++;
               next REF;
              }elsif(/(22\/f.+23\/f.+80\/f.+135\/c|22\/c.+23\/c.+80\/c.+135\/c)/){
- $PH[$j] = $ref;
+ $PR[$j] = $ref;
         $j++;
                next REF;
- }elsif( (/\d\d\/f/) and ( (/\d\d\/o/) or (/\d\d\/c/) ) ){
+ #}elsif( (/\d\d\/f/) and ( (/\d\d\/o/) or (/\d\d\/c/) ) ){
+ }elsif(/(22\/f.+23\/f.+80\/f.+135\/f)/){
           $PF[$f] = $ref;
         $f++;
           next REF;

Frank (frank-bourdeau)
Changed in ocsinventory-server:
importance: Undecided → Low
assignee: nobody → mortheres (mortheres)
Revision history for this message
mortheres (mortheres) wrote :

Hi Frank,

This is bug is also related in Bug #1214436 . I mark it as duplicate of Bug #1214436

Changed in ocsinventory-server:
milestone: none → 2.1
mortheres (mortheres)
information type: Private → Public
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.