3 Replies Latest reply: Dec 6, 2012 1:24 PM by ShadWolf
ShadWolf Level 1 Level 1 (0 points)

Whenever I try to use netstat in Terminal it doesn't print out what it's suppose to print out. Here's what I get when I type netstat;

routing:

          0 bad routing redirects

          0 dynamically created routes

          0 new gateways due to redirects

          4294957722 destinations found unreachable

          0 uses of a wildcard route

          2 routes not in table but not freed

 

 

 

and if I type whereis netstat in Terminal it shows me it's in /usr/sbin/ then when I try typing /usr/sbin/netstat in Terminal it shows me all the routing tables as normal as it should when it's run like so;

 

 

Active Internet connections

Proto  Recv-Q  Send-Q   Local Address          Foreign Address        (state)   

tcp4       0         0          <local_addr>                  <addr>          ESTABLISHED

tcp4       0         0          <local_addr>                  <addr>          ESTABLISHED

tcp4       0         0          <local_addr>                  <addr>          ESTABLISHED

 

(I've edited out addresses for the purpose of this example to show what I should be getting)

 

It's really frustrating why it's not executing the one in /usr/sbin/, I've no idea where it's trying to run the other netstat since it won't tell me, and it only displays 1 when I enter whereis command. I've tried making an alias under my .Profile file but it's got no effect what-so-ever. It's like the link to the file is broken or something. I've tried running Permission Fixes via DiskUtility but that doesn't fix it, I've also tried installing the gnome-netstat from MacPorts and that doesn't work either, I have tried restoring previous state of the system, but still no change either.

 

IS there a way to fix this and get it working as normal? Because I have no idea how to fix a broken link to a file since I don't know where it's trying to run the other netstat from. I also run OSSEC-HIDS which does report checks and it doesn't tell me anything unusual, however it does sometimes report that the current netstat could be trojaned version of netstat, but I've already confirmed that it's a false-positive detection as there's been no changes to the hash sum if it were changed as I have ran multiple tests to confirm it, and even looked up some help from the OSSEC-HIDS support forums. –– I am NOT looking to reinstall the system unless it's really necessary, I would like to just find a simple fix to this little bug problem.

 

I just hope there's no some stupid obvious fix that I missed.


iMac (20-inch Late 2009), Mac OS X (10.7.5), Intel Core 2 Duo @2.66GHz, 8GB RAM
  • BobHarris Level 6 Level 6 (14,945 points)

    Perhaps you have an 'alias' or a 'shell function' answering to 'netstat'

     

    alias netstat

    typeset -f netstat

     

    If you find you have an alias or shell function, then start looking in your shell initialization files.

    .bashrc

    .bash_profile

    .bash_login

    .profile

    /etc/profile

    /etc/bashrc

  • BobHarris Level 6 Level 6 (14,945 points)

    I found an even easier command to check if it is an executable file, a shell function, or an alias, assuming you are using the 'bash' shell (the Mac OS X default):

     

    type netstat
    
  • ShadWolf Level 1 Level 1 (0 points)

    This seemed to work. I found there was an alias created somewhere in a .bashrc file, after removing it it seemed to return to normal for soem reason.