Skip to content

Instantly share code, notes, and snippets.

@gfontenot
Created April 15, 2011 16:40
Show Gist options
  • Save gfontenot/922003 to your computer and use it in GitHub Desktop.
Save gfontenot/922003 to your computer and use it in GitHub Desktop.
Applescript core of a Honeypot application for use with Dropbox and Axel Bauer's isightcapture CLI
on run
tell (current date)
set currentDay to day
set currentMonth to month of it
end tell
set theDate to currentMonth & currentDay as string
set theIP to do shell script "/usr/bin/curl " & quoted form of "http://icanhazip.com"
set this_path to path to me as string
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set parsed_path to text items 1 through -3 of this_path
set this_folder to parsed_path as string
set AppleScript's text item delimiters to tid
tell application "Finder"
get path to home folder
set public_folder to ((result as string) & "Dropbox:Public") as alias
if not (exists folder ((public_folder as string) & theIP as string)) then
make new folder at public_folder with properties {name:theIP}
end if
end tell
set isightcapture to ((POSIX path of (path to me)) & "Contents/Resources/Scripts/isightcapture")
set output_file to (POSIX path of (public_folder) & theIP & "/" & theDate & ".jpg")
set theCommand to isightcapture & " " & output_file
do shell script theCommand
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment