detectsshvncfeatures

How To Tell If Someone Is Spying On Your Computer Using GeekTool

[UPDATE]: An even better solution is the ScreenSharingMonitor, which provides a “native” feel thanks to the Notification Center messages.

ssoff sson

Ever wonder if your employer is watching your computer or connected to it remotely?

detectremotesessions

The method below isn’t foolproof, but you can get an indication that someone is connected to your computer.  It relies on two scripts that detect when certain computer ports are established on your computer.  These two protocols are:

  • VNC / Screen Sharing: port  5900
  • SSH (remote command-line access) port  22

Knowing this, you can use GeekTool to check every few seconds to see if these ports are active.  If they are, you can trigger an action.  In this case, I have two little icons that are either green (no one in connected) or red (someone is connected using one of the above protocols).  I even have a little Star Trek klaxon go off so I have both an audible and visual alert.

Requirements

  1. GeekTool
  2. Star Trek klaxon (optional) –save this to /Users/Shared  (or modify the path in the script)
  3. Geeklet files (or you can manually add the scripts below, but this is the easiest)

Step-by-step Walkthrough

Drag two shell objects onto your Desktop.  Resize them and put them where you want.

draggeejklets

If you want them to show on the menu bar, be sure to check the box Keep on top.

keepontop

Then, click the ellipses button to open up the script editor window.

ellipses

Paste in one of the scripts below (or just double-click the .glet  files if you downloaded them above.

savescript

Next, you should adjust some other settings:

  1. Name: name it something like sshAlert or vncAlert (this will make it easier to organize if you add more geeklets later)
  2. Group (optional): you can use this to organize your geeklets if you add more, otherwise just leave it at Default Group
  3. Refresh every: set this to 3-5 seconds
  4. Font and color (optional): this is the color of the text when no one is connected.  The red text is built into the script.

geektoolsettings

Customize

Klaxon Sound Effect

You can use any sound file you want, but if you have the refresh set to three seconds, it needs to be a short sound file, otherwise it won’t finish playing and may cause problems.

Text Colors and Icons

Text Colors Within the Script

You can change the text color within the script by using the color variables and then putting the end variable where you want the color to stop.  You can also use  ${underline}

Emoji and Other Icons

You can drag and drop just about any icon from the Character Viewer into your script.  I just chose the red and green icons since they were significant to what the script is doing.

drag emoji

  • Rosario

    Nothing happens

    • http://www.jacobsalmela.com Jacob Salmela

      darmok and jalad at tanagra

      • Rosario

        What?

        • http://www.jacobsalmela.com Jacob Salmela
          • Primaso

            Your tutorial doesn’t work.

          • http://www.jacobsalmela.com Jacob Salmela

            I cannot help if you do not provide specifics.

      • Primaso

        After I did everything the same as your tutorial, no red/green lights appear.

        • http://www.jacobsalmela.com Jacob Salmela

          Did you drag and drop the emoji into the GeekTool script window? Your Output encoding should also be set to UTF-8. Also, leave off the shebang if you happened to add that to your script. Does the rest of the script work, just not the colored emoji?

          • Primaso

            Okay, if vnc is green and ssh is red, what does it means?

          • http://www.jacobsalmela.com Jacob Salmela

            It means there is an active SSH session.

          • Primaso

            And what can I do?

          • http://www.jacobsalmela.com Jacob Salmela

            Figure out what is using SSH.

          • Primaso

            Brilliant

  • jim

    Hmm, the SSH disappears and reappears at random. the VNC seems to be working fine. Any guesses?

    • http://www.jacobsalmela.com Jacob Salmela

      This happened to me a few times. I think adjusting the refresh rate a bit higher reduces the chance of that happening.