Skip navigation

Netstat broken

498 Views 3 Replies Latest reply: Dec 6, 2012 1:24 PM by ShadWolf RSS
ShadWolf Calculating status...
Currently Being Moderated
Dec 5, 2012 10:30 AM

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 (12,505 points)
    Currently Being Moderated
    Dec 5, 2012 6:21 AM (in response to ShadWolf)

    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 (12,505 points)
    Currently Being Moderated
    Dec 5, 2012 12:30 PM (in response to BobHarris)

    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
    
    MacBook Pro, Mac OS X (10.7.5), 27&quot; iMac, MacBook, MacMini, etc...

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.