Geek Posted July 9, 2011 Posted July 9, 2011 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/07/open_ports_mac_desktop.jpg" alt="Showing open ports on the Mac desktop" title="open_ports_mac_desktop" width="620" height="353" class="aligncenter size-full wp-image-18499" /></p> <p>You can watch all open network connections for both incoming and outgoing transfers using a free command line utility called open_ports.sh. Open_Ports is much more useful than using <a href="http://osxdaily.com/2009/09/29/list-all-open-internet-connections-on-a-mac-to-track-down-bandwidth-issues/">lsof to list open internet connections</a>because it provides extensive network information in a very easy to read format, including what program or process is opening the connection, which port and user, the number of connections per process, the hostname being connected to, the country, and even the city. </p> <p>Additionally, open_ports shows you all of your open ports listening for connections, again with information about the application, user, port number and name, and even the service IP range. All of the output is color coded, a red background signifies the process is owned by root, red text means the IP address doesn’t correspond to a domain name, blue means the IP matches several domain names, and green text means the protocol is encrypted.</p> <p>Installation requires some experience with the <a href="http://osxdaily.com/category/command-line/">command line</a>, but chances are if you want an application like this then that won’t be an issue. Here we go… <span id="more-18497"></span></p> <h2 style="font-size:1.2em;">Installing Open_Ports in Mac OS X</h2> <p>These are are the installation instructions <a href="http://cs.lth.se/kontakt/peter_moller/script/open_portssh_en/">directly from the developers page at Lunds University</a> in Sweden, they have been verified to work in Mac OS X 10.6.8:</p> <p><strong>Warning:</strong> This is a bash script that runs as root that downloads other scripts from the web. This has obvious potential security issues and if you are not comfortable with that or you are in a delicate network environment, this is not recommended to use. The script works as intended, and you can verify the source of the bash script yourself if you want, but if you have any questions or hesitation about running a third party script as root then you may want to use an alternate method to watch open connections, <a href="http://osxdaily.com/2009/09/29/list-all-open-internet-connections-on-a-mac-to-track-down-bandwidth-issues/">using lsof</a> for example. Proceed at your own risk.</p> <blockquote> <ol> <li>Fetch the install-script from <a href="http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/open_ports_install.sh" target="_self">http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/open_ports_install.sh</a></li> <li>Start a terminal</li> <li>Become root: if you are a normal user, type <code>sudo <i>adminusernamne</i></code> and then <code>sudo -i</code> if you are an admin-user, type <code>sudo -i</code></li> <li>Set access rights for the install script: <code>chmod 755 open_ports_install.sh</code> (you must locate it)</li> <li>Run the script: <code>./open_ports_install.sh</code> </li> <li>The installation is normally quick. For Linux, that all. On a Mac it ands with GeekTool being opened. To install it, double-click it’s .PrefPane</li> <li>In GeekTool: click the icon named ”Shell” and drag it to an empty part of the desktop (must be free of windows). Size it as well.</li> <li>A ”Properties”-window opens. What you need to enter is: <ul> <li>Command: open_ports.sh</li> <li>Refresh every: 120 s</li> <li>Change font to a monospace-one (I’m using Menlo and white font color)</li> </ul> </li> <li>Now you may close GeekTool</li> </ol> </blockquote> <p>The other great thing about open_ports is that the Mac OS X version is built to be used in GeekTool, so you can display the output on your Mac desktop. If you’re going to use it through GeekTool, I would suggest using a more plain background picture otherwise the text is hard to read, this is how it looks against the <a href="http://osxdaily.com/2011/06/06/mac-os-x-lion-galaxy-andromeda-space-wallpaper/">OS X Lion Galaxy wallpaper</a>.</p> <p><img src="http://osxdaily.com/wp-content/uploads/2011/07/open-ports-mac-desktop.jpg" alt="Show open network connections on the Mac OS X Desktop" title="open-ports-mac-desktop" width="620" height="388" class="aligncenter size-full wp-image-18498" /></p> <p>If you want to unintsall open_ports from Mac OS X, use the following commands as root: <code>launchctl stop se.lth.cs.open_ports</code></p> <p><code>launchctl unload /Library/LaunchDaemons/se.lth.cs.open_ports.plist</code></p> <p>Then you can delete the scripts: <code>rm -rf /usr/bin/open_ports.sh (the script)</code></p> <p><code>rm -rf /Library/LaunchDaemons/se.lth.cs.open_ports.plist (the gather control)</code></p> <p><code>rm -rf /Library/cs.lth.se/OpenPorts (the data files)</code></p> <p>In case you were wondering, there is also a Linux version available. I came across this awesome utility on <a href="http://hints.macworld.com/article.php?story=20110623032425485">MacWorld</a>, but MacWorld didn’t actually test the script to verify that it works, but I can confirm that it definitely does.</p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/2k5T9Caz6Cd-TunypPm-ejmYVeY/0/da"><img src="http://feedads.g.doubleclick.net/~a/2k5T9Caz6Cd-TunypPm-ejmYVeY/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/2k5T9Caz6Cd-TunypPm-ejmYVeY/1/da"><img src="http://feedads.g.doubleclick.net/~a/2k5T9Caz6Cd-TunypPm-ejmYVeY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UVgF7Ua4I70:v5qF8KVK7ag:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UVgF7Ua4I70:v5qF8KVK7ag:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=UVgF7Ua4I70:v5qF8KVK7ag:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UVgF7Ua4I70:v5qF8KVK7ag:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=UVgF7Ua4I70:v5qF8KVK7ag:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UVgF7Ua4I70:v5qF8KVK7ag:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UVgF7Ua4I70:v5qF8KVK7ag:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/UVgF7Ua4I70" height="1" width="1"/> View the full article
Recommended Posts