./hadak

Stroke – a built in OS X port mapper

by Hans Kokx on Apr.01, 2009, under Mac OS X

Introduction

Knowing what ports are open on your machine is half the battle of locking it down. Knowing that you have a rogue web server running on port 6337, or realizing that somebody forgot to disable SSH logins can mean all the difference when under attack from an unknown entity. Preferably, we'd use a tool such as nmap or nessus to perform these checks for us. However, if the option isn't available, we can use an app that's already built in, albeit hidden, in OS X: Stroke.

Enter Stroke

Stroke is a command line utility for port scanning a specified host. This little gem is very easy to use, simple to gain access to, and already exists on your machine. To access stroke from the command line, it is easiest to alias it.

hello:~ you$ sudo ln /Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke /usr/bin/stroke
Password:
hello:~ you$ chmod uo+x /usr/bin/stroke
 

You should now be able to access stroke from the command line with pre>$: stroke/pre>.

How do I use Stroke?

Stroke contains no manual entry. Luckily, it is very easy to use. Once you've got it set up, you need to specify three pieces of information for Stroke to use.

hello:~ you$ stroke 127.0.0.1 1 100
Port Scanning host: 127.0.0.1
 
	 Open TCP Port: 	22     		ssh
	 Open TCP Port: 	80     		http
	 Open TCP Port: 	88     		kerberos
 

In this example, we have specified that we wish to port scan our localhost (127.0.0.1) for all open ports between port 1 and 100. That's it! Press enter, and the port scan begins. In our example, we have returned ssh, http, and kerberos - as they are the open ports running between port 1 and 100.

Conclusion

Nmap and nessus are certainly more powerful, but in a pinch Stroke gets the job done. It's built in, although hidden, in OS X and is very easy to use.

Should you have any questions about the access and usage of Stroke, be sure to leave a comment.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Print
  • StumbleUpon
  • Technorati
  • TwitThis

2 Comments for this entry

  • PeterM

    I found stroke running (I have Activity Monitor on in the background) after I tried to log into a site that had a bad cert. I Killed it and then followed your steps above and it found nothing.
    Do you know what could have started stroke?

    Thanks for the info above.
    Regds, Peter M.

    • Hans Kokx

      Being that Stroke is a built in utility, any number of native applications could have launched it. Perhaps you were using Safari? It’s possible that Safari launches Stroke in some instances.

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...