An addition to… Take iSight snapshots during invalid login attempts

Check out this post on Mac OS X hints.com: Take iSight snapshots during invalid login attempts.

It is a pretty cool setup, if someone enters the wrong password on your laptop, picture is taken and stored. That’s neat, but I’m pretty sure I’m not going to check the /var/logs/authfail folder so I wrote a quick script that looks to see if there is an item in the folder and displays it in Preview. Add the script to your login items and your all set!

Download the script:Login Attempt picture viewer
To use it, open System Preferences, click on Accounts, choose your accounts and drag drop the script into the login items.

19 Responses to “An addition to… Take iSight snapshots during invalid login attempts”

  1. ty Says:

    you are the man dogg

  2. Sam Says:

    Thanks very much:) worked as described.

  3. ty Says:

    hey now how do you clear the history i’m still getting tons of pics from previous attempts now i want to delete have see whats current.

  4. matt Says:

    If you command click on the title of the document in Preview, it will present a drop down menu showing what folder it is in. Click on the folder the image sits in, it will open the folder in Finder. Select the files, drag to trash, it’ll ask you for your password.

    I figure that’s easy enough, as I bet I won’t have more than 1 login attempt a month.

  5. Lucas Cantor Says:

    Is there any way to change the target folder from authfail to the desktop?

  6. matt Says:

    Lucas: I did not write the original script on macosxhints.com. I took at look at it and it appeared you could just change the perl script to where it dumps the pictures (such as your desktop,) but I was worried about if the script would have permissions… so instead I threw this together.

  7. grant Says:

    Nice one. If you remove step 2, Preview will open all the images in one window, just as if you ran ‘open -a Preview /var/log/authfail’.

  8. matt Says:

    Thanks for the comment grant. I had originally tried that setup, but that results in Preview opening even if their are no photos. I wanted this to be the least intrusive.

  9. Jim Says:

    You could always create a cron job to move the files from the authfail folder to your desktop every minute.

    Using terminal, enter the following commands:
    1. crontab -e (a vi editor window will open)
    2. * * * * * /home/Users/username/moveMe
    3. SHIFT + zz (the changes will be saved and the vi editor window will close)
    4. vim moveMe (a vi editor window will open)
    5. mv /var/log/authfail/* /Users/jim/Desktop/.
    6. SHIFT + zz (the changes will be saved and the vi editor window will close)
    7. chmod +x moveMe
    8.sudo chmod 777 /var/log/authfail/

    Every time a picture is added to the authfail folder, it will be moved to your desktop. If you don’t keep a cluttered desktop, it should be obvious that someone tried to hack into your system as soon as you log into your account and of course it will be easy to delete the pictures!

  10. Jim Says:

    doh!

    Replace ‘username’ and ‘jim’ from my last response with your username.

  11. William Gibb Says:

    This app is nice. However, how would I make it run whenever I login from a screensaver? I added it to my login items as described in the post, and currently it only works when I login to the machine (as it should). Is there a way to make this work when I login from screensaver/resume the computer from sleeping? I rarely, if ever, shutdown my MBP or logout, since I’m a student and often moving about. Currently I’ve got folder actions enabled on /private/var/logs/authfail to run the show new items action, which does work to open /var/log/authfail, but doesn’t automatically open the images. I’m not sure how to open the images using applescript or otherwise.

  12. grant Says:

    I found a pretty good solution using folder actions.

    1. enable folder actions (right-click on a folder in Finder)
    2. make an Automator workflow with only one action: Open Images in Preview
    3. File → Save As Plug-in…
    4. give it a name
    5. change ‘Plug-in for’ to ‘Folder Actions’
    6. choose ‘Other…’ for ‘Attached to Folder’
    7. hit ⌃⇧G and type ‘/var/log/authfail’
    8. click Save

    Seems to work properly, and it only opens new images.

  13. matt Says:

    William, I think Grant answered your question. That looks great. I love all the cool ways to automate stuff on the mac.

  14. Smactron Says:

    This is awesome! Thanks for the tip, grant. Now, can someone make a full package for all of this so that a newb like me (although I eventually figured it out) would only have to hit Install and have this all done automatically for him/her? A quick suggestion: could there be leading zeroes for the date/time if one is only one digit long? And could it sort by decreasing unit of time? I’d rather have the formula “[username] [year] [month] [day] [hour] [minute ][second]” so that I could sort by filename and still be sorted by date. What do you think?

  15. William Gibb Says:

    Each time I learn something new on OS X, I love the OS more and more, especially with aspect to the automation. Hell, now I know how to make folder actions easily. Doing what grant posted works great, but I wanted a little more. I took the script that Automator exported and added to it from the show new items action. Here is the action I’ve got running on /var/log/authfail

    on adding folder items to this_folder after receiving added_items
    tell application “Finder”
    activate
    open this_folder
    reveal the added_items
    end tell
    tell application “wgibb:Library:Workflows:Applications:Folder Actions:imageopen.app”
    open added_items
    end tell
    end adding folder items to

  16. OS X Daily » Take iSight Snapshots When Invalid Login is Detected - Mac OS X Apps, Tips, Tricks, News, Updates, Everything Mac OS X Says:

    [...] Automator Script for Image Viewing [...]

  17. Don Lapre Lenny Says:

    Thanks to you for giving the very needed informations to one and all…really you are genius !

    Don Lapre Lenny
    webmaster@donlapresite.com
    http://www.donlapresite.com

  18. k huffine Says:

    Hi..How do u delete the older pics that the isight has taken…I try to delete them but they come back like a boomerang. Thanks Ken

  19. Kostakis Says:

    This is perfect! Very nice job, well designed, well explained. Well done! Works PERFECT! Thumbs up ;)

Leave a Reply