Okay Blog, I've been neglecting you. Today, I'll outline a neat little trick once again using the amazing automation tool, Tasker.
First, I've an admission to make. My phone doesn't use one of those coded lockscreens. There's a couple reasons for this... I don't have time to deal with it, and it's far too easy to get around those screens by looking at a screen at a shallow angle and seeing where the fingerprints are.
That said, my phone hardly is lacking in the security department. I've written a few pretty involved scripts in Tasker that will, when I text the phone a secret phrase, turn my phone into an information-gathering powerhouse.
Specifically in this post I'm going to describe how I can covertly and remotely grab photos from the front and rear cameras on my phone as well as see the ugly mug of the last person who unlocked my screen, and have those photos quietly emailed to me. This can be an awesome tool if your phone is stolen or if you just want to know who the last person to unlock your screen was.
Your phone has to be running Gingerbread if you want to use the front-facing camera.The reason? Gingerbread has a new API built-in to allow programs (such as Tasker) to access the front-facing without having been written specifically for your model of phone.
Got Gingerbread? Or just going to use the back camera? Okay. Now you need to download and install the app "SL4A" from here. This program is an Android scripter that will let your phone run scripts written in other programming languages. Once you get into the program, follow the instructions here, using a Python interpreter for Step 6. This should install another APK on your phone called "Python For Android". Open it and click Install.
Got Python? Awesome. To make sure it's installed properly, go back into SL4A and you should be greeted by a list of scripts with names like "bluetooth_chat.py", "hello_world.py" etc. Now follow the instructions here to install the sendemailA.py script that can quietly send out an email with a photo attachment. I'm going to take a moment here to give a huge amount of credit to "baudi", who wrote the script, this wouldn't be possible without it.
Okay here's the part where we actually fire up Tasker to do the dirty work.
If you don't already have Tasker, download it off the Android Market, or give it a 7-day trial from the Tasker website. Trust me, it's worth purchasing after the end of the trial, it's the best $5 I've ever spent. (Update: apparently it's $7 now... but I still think it's worth it at less than the cost of lunch.)
Now, you'll need to create 2 new Profiles and 4 new Tasks. I'm not going to babysit you through every piece of this, so if you need something that covers the basics of how to use Tasker, read their tutorial.
The first Profile I like to call "Watcher". What this does is covertly take a photo using the front-facing camera every time the screen is unlocked. So create the Profile, and the context, or trigger, for this profile is, obviously "Display Unlocked". This can be found under Event, Display, Display Unlocked.
Create a new Task for the Watcher profile titled "Front Spy". This is a one-step task that takes the covert photo. For the action, select Media, Photo. Select Front for the camera, and the filename is "%PHOTONUMBER" minus quotes. This is a variable that we'll be working with a little later. Select the option for "Discrete" and make sure "Insert in Gallery" is unchecked, to keep things covert. That's all we need to do for this task and this profile. Lock your screen, unlock your screen, go to the folder where your camera stores photos, go to the Tasker folder, and you should see a picture of yourself unlocking your screen. Sweet, right?!
Create a new Task exactly the same as the above but titled "Back Spy" and using the rear camera. You can do this easily by clicking the Task icon (a little orange lightning bolt on the main screen in Tasker) and selecting New Task. We'll use this later.
Now create another Task named "Photo Email" or some such. This task has 7 steps to it. The Variable Set/Add are under the Variable category (imagine that), and Run Script is under Misc.
- Variable Set
Name: %PHOTONUMBER
To: 1
If: %PHOTONUMBER ! Set
(This step sets the variable %PHOTONUMBER to equal 1 if the variable doesn't have a value). - Variable Set
Name: %EMAIL_USER
To: (your gmail account username. Do not include the @gmail.com part.) - Variable Set
Name: %EMAIL_PSWD
To: (your gmail account password. Don't worry, I've reviewed the python script and it doesn't do anything with this other than log into your email account. We'll also lock Tasker later so people using your phone can't see this!) - Variable Set
Name: %EMAIL_TO
To: (the email address you want to email your photos to. Pro tip: don't send them to an account that can be accessed by your phone without logging in!) - Variable Set
Name: %EMAIL_ATTACH
To: (path to your %PHOTONUMBER.jpg file. For me it's "/sdcard/DCIM/Tasker/%PHOTONUMBER.jpg) - Variable Add
Name: %PHOTONUMBER
Value: 1
(adds one to the %PHOTONUMBER value so that each time you email something it creates a new file instead of saving over the old one). - Run Script
Name: sendemailA.py
Pass Variables: %EMAIL_USER,%EMAIL_PSWD,%EMAIL_TO,%EMAIL_ATTACH
(Handy tip, you can pick these variables off a list by clicking on the orange tag icon.)
Whew! Alright, the hard part is done, trust me, we're almost there.
Now we create a new Profile titled "PIXORSTFU". The Context is going to be "Received Text" under Event, Phone, Received Text. Set Content to "PIXORSTFU" minus quotes. If you want to restrict this to a certain number (maybe your friends like saying that phrase?) you can do so under Sender.
Lastly, we add a task to PIXORSTFU that we don't need to name anything. This is pretty simple, Perform Task is under the category Task:
Lastly, we add a task to PIXORSTFU that we don't need to name anything. This is pretty simple, Perform Task is under the category Task:
- Perform Task
Name: Photo Email
(You can select this from a list by clicking the magnifying glass.) - Perform Task
Name: Front Spy - Perform Task
Name: Photo Email - Perform Task
Name: Back Spy - Perform Task
Name: Photo Email
This next step is VERY important! We don't want people able to get into our Tasker and disable this stuff, so we've got to set up a lock code. Select Menu, Preferences, scroll down to Lock Code, enter a code of your choice (but something you won't forget!) and select Lock On Startup. (Just learned that you may not be able to lock the Trial version of Tasker, so pony up already!)
So, text message PIXORSTFU to your phone from another phone or Google Voice or what have you, then lock and unlock your screen, and do it again. This time you should receive 3 emails: one from the last time the screen was unlocked, and one from the front and rear cameras moments after the text message was received.
There you have it ladies and gents. Now your phone has become a secret surveillance tool. I'll be doing another blog at some point with an even more involved script in Tasker that incorporates part of this one and gathers a ridiculous amount of data that can be used in tracking your phone down. Trust me, Lookout and some of those other phone-tracking apps have nothing on it!
EDIT - Thinking about making a couple minor changes so that you can get sent pictures from the last two unlocks. There may be circumstances where you didn't know your phone was messed with until after you've unlocked it. I'll update if I decide to do this.
Tasker is $6.99 now, FYI.
ReplyDeleteThanks for the heads-up, John. The price seems to have been creeping upwards... but I maintain that it's worth the price.
ReplyDeleteFor those looking for something like Tasker that's free but not as involved, I've been told that AutomateIt is a decent alternative available on the Android Market. You might not be able to do what I've described here but for many people a couple simple actions and triggers is all they need.
I get an error when the python script is run. Is there something wrong with my python installation?
ReplyDeletedlopen libpython2.6.so Traceback (most recent call last): File "/mnt/sdcard/sl4a/scripts/sendemailA-2.py", line 4, in from email import encoders File "/mnt/sdcard/sl4a/scripts/email.py", line 4, in from email import encoders ImportError: cannot import name encoders
Looks like it, though I notice your script is named sendemailA-2.py, when it should just be sendemailA.py.
ReplyDeleteI assume you installed SL4A, opened the app, and installed the Python For Android interpreter already?
If you have, when you start SL4A, you should see a list of scripts, such as bluetooth_chat.py, hello_world.py, etc. sendemailA.py should be on the list. You can rename it by clicking on it, selecting the Save icon, and entering the correct name.
If you've done all this and it still doesn't work, I'm not sure what's wrong!
EDIT - Ohhh... I'm not finding SL4A on the market anymore... just something similar called SL4A Scripter! Make sure the SL4A APK you're using is the one from here: http://code.google.com/p/android-scripting/
Thanks for the reply. I had an issue with another file named email.py that I had created for different purpose. After removing it, the sendemailA.py works fine. However, there is a different problem now.
ReplyDeleteI have this sequence of tasks to be performed to capture photo using front camera, email photo, capture photo using rear camera, email photo and notify sound at the end.
1. Front Spy
2. Email Photo
3. Back Spy
4. Email Photo
When I run this sequence, it only captures the photo from front cam and emails the same. The other two tasks - Back Spy and Email Photo dont seem to execute at all. I receive only on mail with the photo from front cam.
I reversed the order (swapped steps 1 and 3) and see only photo from the rear cam being mailed.
Here is the run log for the execution - Am I missing something?
20111020 16.20.54 T RUNNING ID17/1
A1: Perform Task [Name:Front Spy Stop: Priority: %par1: %par2: Return Value Variable:]
A2: Perform Task [Name:EmailPhoto Stop: Priority: %par1: %par2: Return Value Variable:]
A3: Perform Task [Name:Back Spy Stop: Priority: %par1: %par2: Return Value Variable:]
A4: Perform Task [Name:EmailPhoto Stop: Priority: %par1: %par2: Return Value Variable:]
A5: Notify Sound [Title:Done Text: Icon: Number: Sound File:]
20111020 16.20.54 T RUNNING ID3/2 Front Spy
20111020 16.20.54 T RUNNING ID19/3 EmailPhoto
20111020 16.20.54 T RUNNING ID4/4 Back Spy
20111020 16.20.54 T REJ_COPY ID19 EmailPhoto
20111020 16.20.54 T EXIT_OK ID17/1
A1: Perform Task [Name:Front Spy Stop: Priority: %par1: %par2: Return Value Variable:]
A2: Perform Task [Name:EmailPhoto Stop: Priority: %par1: %par2: Return Value Variable:]
A3: Perform Task [Name:Back Spy Stop: Priority: %par1: %par2: Return Value Variable:]
A4: Perform Task [Name:EmailPhoto Stop: Priority: %par1: %par2: Return Value Variable:]
A5: Notify Sound [Title:Done Text: Icon: Number: Sound File:]
20111020 16.20.55 T EXIT_OK ID19/3 EmailPhoto
20111020 16.20.56 T EXIT_OK ID4/4 Back Spy
20111020 16.21.00 T EXIT_OK ID3/2 Front Spy
This is amazing. I was curious about one thing. So we got it to work with turning the display on. And we got it to work when the text message was sent. However, that would result in having to have this on the entire time --> tons of emails.
ReplyDeleteIs there a way to set a condition for profiles? For example, we have it so the screen unlock turning on takes pics, and getting that text message takes pics. Is there a way to make it so that the screen unlock profile is off by default, and only turns on if a text is sent?
So, text sent. Nothing happens EXCEPT for turning on the screenunlock profile. From that moment, every time that person unlocks, a picture is taken. Then a second text can deactivate the profile.
Is this possible?
Yes this is possible. Stick to SMS content event and set variable for condition on/off
ReplyDeleteThanks Jenya! Looks like I missed the notification for Michael's comment.
ReplyDeleteI haven't set up any new Tasker profiles in a while... I guess I just sort of take them for granted now. I still maintain that it's been the best purchase I've made on Android!