Jump to content


Photo
- - - - -

Remote Shutdown Via SMS


  • Please log in to reply
31 replies to this topic

#1 daedalus

daedalus

    Hak5 Fan +

  • Members
  • PipPipPip
  • 43 posts

Posted 30 April 2008 - 12:48 AM

I recently read an article on lifehacker that explained how to shut down windows with a text message.
(http://lifehacker.co...sage-172873.php)
Although I think this is a really cool idea, I don't own microsoft outlook and I wanted to figure out a more portable way to go about setting up this project on my computer.

With an add-on and a few tweaks, it is possible configure this, with a portable copy of Mozilla Thunderbird.
This should take < 10 minutes to set up and configure.

Step 1 - Get thunderbird portable

Download a copy of portable thunderbird:
http://portableapps....erbird_portable
and extract it by running the exe.

Step 2 - Setup thunderbird & install add-on

First of all, set up an email account. I created a gmail account just for this project. Go through thunderbird's setup process and make sure your email account is configured properly. You'll probably need to login to your account and enable POP/IMAP settings.

Now that you have a portable, working copy of mozilla thunderbird, download this add-on:
https://addons.mozil...bird/addon/2610
This is what makes it all work.

To install this into the thunderbird portable folder, open ThunderbirdPortable, and go to Tools -> Add-ons and click install. Direct thunderbird to the .xpi file you downloaded and it will install the add-on.

Restart thunderbird to proceed.

Step 3 - Configure inbox

Before you can configure the options for the add-on, you'll need to create a folder that will hold the text messages. Right click on "Inbox" and click new folder. Name this something memorable. I named mine "SMS"



Next, click Tools -> Message Filters. Here you will pick the requirements your text message must meet in order to shut down your computer. Click "New" and create a filter. Configure your filter to meet some requirements in the top box, and configure the second box to move the message into the folder you created earlier.



Step 4 - Configure add-on

Before the add-on can run, it needs a command to run. Create a batch file in the portable thunderbird program directory that contains something like this:

CODE
shutdown.exe -s


In my example, I'm naming it shutdown.bat

Next, open up your portable thunderbird and click on the folder you created earlier ("SMS" in my case). Then, go to Tools -> Mailbox Alert Preferences



IMPORTANT : Make sure that you have selected your folder BEFORE editing the mailbox alert preferences. Otherwise, you will end up shutting down your computer every time you receive an email.

Check the Execute a command: checkbox as I have above, and point it to the shutdown batch file. Hit OK.

To decrease the delay between the sending of the text message to the shutting down of the computer, go to Tools -> Account Settings...
click "Server Settings" on the left side under the account you will be receiving text messages on. Under the server settings part of the box, change Check for new messages every _30_ minutes to every _1_ minute.




Well done. Running this portable program will enable you to shutdown your computer from anywhere, as long as your computer is connected to the internet and you have a phone. Try it out - send a message to your email address that meets the criteria you set up in the filter. If everything works out, next time thunderbird checks for messages, it should get your SMS and shutdown.


This concludes the practical part of the guide, but, as I'm sure you've processed, this could potentially be used from ANY computer connected to the internet to run ANY program. This has quite a lot of potential, so I decided to see what I could whip up in a couple of minutes.


idea - run the program invisibly, in the background

This is fairly easy to set up. Download nircmd (http://www.nirsoft.n...ils/nircmd.html) and place it in your thunderbird folder. Nircmd is a really cool tool that can be configured to do quite a lot of things. Read the .chm in the zip to see all of the options. After you have placed the executable in the folder (nircmdc.exe), create another batch file.

put this in the file:

CODE
@echo off
start ThunderbirdPortable.exe
nircmdc cmdwait 5000 win hide ititle "Thunderbird"


This is a fairly simple batch file, which will open thunderbird in a new process, wait 5 seconds (for thunderbird to initialize and start up) and then hide the window. The program is still viewable in the your processes, but it isn't viewable in the taskbar.

Now all you need to do is double click the batch file you have just created, wait a few seconds, and you will have a portable thunderbird running in the background, ready to shutdown your computer when it receives the right message.

I'm sure you can think of many more ideas to add to this, so contribute whatever you're thinking. My apologies if I left out anything important in this guide. Please let me know if I did. If you get it working, let me know how it goes.


daedalus

#2 SomeoneE1se

SomeoneE1se

    Hak5 Junkie

  • Active Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 2,801 posts
  • Gender:Male
  • Location:192.168.0.100

Posted 30 April 2008 - 03:51 AM

I don't have much use for this but it's damn cool.  VERY nice work!
QUOTE
And why in Apple world does "off" mean "not really mate"? -- VaKo

#3 daedalus

daedalus

    Hak5 Fan +

  • Members
  • PipPipPip
  • 43 posts

Posted 30 April 2008 - 05:56 PM

Thanks.  I haven't tried this thunderbird setup on linux yet, but i'd imagine that it would work for any OS that can run thunderbird.

Also, here are the two articles I originally read on lifehacker:
How to shutdown your mac via SMS - http://tinyurl.com/54d6pb
How to shutdown windows (with outlook) via SMS - http://tinyurl.com/mpe5o

I also played around a bit more with it, and now it's set up to show the blue screen of death and shutdown when "BSOD" is sent to it.  Using this, I BSOD'd a few computers in my house at the same time.  Not very practical, but fun nonetheless.


daedalus

#4 nicatronTg

nicatronTg

    Hak5 Pirate

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts
  • Gender:Male

Posted 30 April 2008 - 08:58 PM

Ooo, thanks! I only have one complaint:
Thunderbird takes up too much ram for an old server machine.

Other than that, it seems to be a good idea for server admins.
QUOTE (Kerberos @ Sat, 22 Aug 2009 15:32:45 +0000) <{POST_SNAPBACK}>
I have a bunch of sticks of really old RAM. Like...really old. Can anyone think of any possible uses for them? Anything at all?

QUOTE (VaKo @ Sat, 22 Aug 2009 16:32:00 +0000) <{POST_SNAPBACK}>
Throw them at passing traffic.

#5 911alertme

911alertme

    Hak5 Zombie

  • Members
  • PipPipPipPipPip
  • 169 posts
  • Location:Canada

Posted 30 April 2008 - 10:10 PM

I like it.  I set up something like this with Outlook before.  We definitely need more threads like this one.

Good work.

#6 Phredsir

Phredsir

    Hak5 Fan

  • Members
  • PipPip
  • 31 posts
  • Gender:Male
  • Location:Phoenix, AZ
  • Interests:laptops

Posted 01 May 2008 - 01:04 AM

This would be funny to do at school.

#7 daedalus

daedalus

    Hak5 Fan +

  • Members
  • PipPipPip
  • 43 posts

Posted 01 May 2008 - 05:17 PM

I've been trying to think of ways to make this more portable, so I came up with this.

Scenario: You have a computer you want to shut down via SMS and a USB drive, with portable thunderbird on it.

Normally, you would need to find a place to copy it to on the computer, edit all of the paths, and then start it up.  Here's an easier way.

First of all, copy the folder over to your USB drive.  Make the rest of the changes in there.  Next, you want to open your portable copy of thunderbird.  Click on the folder you created ("SMS" in my case), and go to Tools -> Mailbox Alert Preferences.  Edit the box following "Execute a command:", and change it to: "C:program filesThunderbirdshutdown.bat" .

Next, in your folder, create a batch file in the thunderbird folder (I called mine copy.bat).

Put this in there:
CODE
@echo off
c:
mkdir "c:program filesThunderbird"
xcopy /Q /E /Y /H  * "c:program filesThunderbird"
cd "c:program filesThunderbird"
del copy.bat
run.bat


This does a few things.  First, it turns off echoing and navigates to the c: drive.  Next, it makes a directory called "Thunderbird" in the program files, and copies all the files in the current folder to it.  If it's in the same folder as the thunderbird portable stuff, this should work correctly. 

The xcopy options tell it not to be verbose (/Q), copy subdirectories (/E), overwrite without prompt (/Y), and copy hidden and system files (/H).  Only the /Q switch is really nessesary, so i'm pretty sure it would be okay to take out any others you are unsure about.  These switches (/Q, /E, /Y, and /H) conform to vista's syntax, so you may need to change it if you are running XP.

The rest of the batch file navigates to the directory, removes the copy batch file, and runs run.bat .

Now, you should be able to double click this and have the program copied to the computer, then started locally.  If thunderbird takes a long time to start up after copying, you might need to edit the "nircmdc cmdwait 5000 win hide ititle "Thunderbird" " command in the run.bat script to a number larger than 5000 (5000 = 5 seconds).

Also, if you wanted to quickly remove the program, put this in a batch script (named mine "remove.bat")

CODE
@echo off
c:
cd "c:program files"
del /S /Q Thunderbird
rmdir Thunderbird


The /S /Q switches delete all subdirectories and make the program quiet, respectively.

Let me know how this goes for you.


daedalus

#8 Joerg

Joerg

    Hak5 Pirate

  • Members
  • PipPipPipPipPipPip
  • 305 posts
  • Gender:Male
  • Location:Germany

Posted 02 May 2008 - 08:00 AM

Is it possible to do the same with the stricter rights management on a linux based system? According to my console, I need to be root in order to shutdown the system and providing the root passwort is not the best idea.
joerg@server:~$ cat /var/www/hak5/signature
cat: /var/www/hak5/signature: No such file or directory

#9 SomeoneE1se

SomeoneE1se

    Hak5 Junkie

  • Active Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 2,801 posts
  • Gender:Male
  • Location:192.168.0.100

Posted 02 May 2008 - 01:15 PM

create a dir that ONLY you're user can see or write to, and create a root cron job to check to see if /home/user/secret/dir/shutdown.file exists if it does delete it and shutdown...
QUOTE
And why in Apple world does "off" mean "not really mate"? -- VaKo

#10 nicatronTg

nicatronTg

    Hak5 Pirate

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts
  • Gender:Male

Posted 02 May 2008 - 07:36 PM

QUOTE
Is it possible to do the same with the stricter rights management on a linux based system? According to my console, I need to be root in order to shutdown the system and providing the root passwort is not the best idea.

using root, change the permissions for your account to be able to run the halt command.
QUOTE (Kerberos @ Sat, 22 Aug 2009 15:32:45 +0000) <{POST_SNAPBACK}>
I have a bunch of sticks of really old RAM. Like...really old. Can anyone think of any possible uses for them? Anything at all?

QUOTE (VaKo @ Sat, 22 Aug 2009 16:32:00 +0000) <{POST_SNAPBACK}>
Throw them at passing traffic.

#11 Sparda

Sparda

    Hak5 Junkie

  • Active Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,849 posts
  • Gender:Male

Posted 02 May 2008 - 08:00 PM

http://www.linuxques...as-user-350891/

#12 Joerg

Joerg

    Hak5 Pirate

  • Members
  • PipPipPipPipPipPip
  • 305 posts
  • Gender:Male
  • Location:Germany

Posted 03 May 2008 - 05:44 AM

Thanks
joerg@server:~$ cat /var/www/hak5/signature
cat: /var/www/hak5/signature: No such file or directory

#13 911alertme

911alertme

    Hak5 Zombie

  • Members
  • PipPipPipPipPip
  • 169 posts
  • Location:Canada

Posted 03 May 2008 - 06:18 PM

Congrats.  You made a post on Lifehacker.  http://lifehacker.co...derbird-edition

#14 sablefoxx

sablefoxx

    Hak5 Ninja

  • Active Members
  • PipPipPipPipPipPipPip
  • 572 posts
  • Gender:Male
  • Location:/Milkyway/Terran System/Earth/
  • Interests:Greatest Albums:<br />-----------------------------------------------------<br />The Dark Side of the Moon - Pink Floyd<br />Give Up - The Postal Service<br />The Classics - Ratatat<br />-----------------------------------------------------

Posted 04 May 2008 - 12:03 AM

QUOTE
Congrats.  You made a post on Lifehacker.  http://lifehacker.co...derbird-edition


EPIC! Soon We'll Hit Digg, and then the servers will die.  :-(


PS:

Who's gonna make this into a switchblade payload?
i7 860 @ 3.36GHz / P55 EVGA / 4Gb DDR3 / 2x GTX 460s in SLi / 2x1Tb RAID 0 / 40Gb Intel SSD

#15 Joerg

Joerg

    Hak5 Pirate

  • Members
  • PipPipPipPipPipPip
  • 305 posts
  • Gender:Male
  • Location:Germany

Posted 04 May 2008 - 03:42 AM

I don't think that integrating Thunderbird into the Switchblade would be a good idea as it costs space and ram. An alternative would be a "wget-like" command which checks if a file on a web server exists and then calls a program which shuts the machine down.
joerg@server:~$ cat /var/www/hak5/signature
cat: /var/www/hak5/signature: No such file or directory

#16 Blue Dragon

Blue Dragon

    Hak5 Fan ++

  • Active Members
  • PipPipPipPip
  • 77 posts

Posted 04 May 2008 - 04:16 AM

Great article! I really like it.
But how the hell do I send a text message from my phone to an emailadress? I only have an old siemens A60 wich does little more then sending text messages (SMS) and phoning some friends. When I send an SMS I can only put in the phone numer of someone as far as I know. How can I put in a gmail-adress? Do I need something like the iPhone to do this? Sry for my stupidity, just hope someone can help me!
Edit: Well, after some googling I found out that there are different websites that offer a phone number you can send a message to. In this message you have to first type the emailadress and then the text you want to be sent.

#17 911alertme

911alertme

    Hak5 Zombie

  • Members
  • PipPipPipPipPip
  • 169 posts
  • Location:Canada

Posted 04 May 2008 - 09:32 AM

You could try sending an email to your phone.  Your email address would be 1-areacode-phonenumber@whateveryourserviceprovidersthingis you can probably find it somewhere on the internet.  Once you have this email on your phone then you can probably hit reply and it will go to the email address.

#18 Deveant

Deveant

    Hak5 Uber fan +++

  • Active Members
  • PipPipPipPipPipPipPipPipPip
  • 1,126 posts
  • Gender:Male
  • Location:Australia

Posted 04 May 2008 - 09:44 AM

QUOTE
Great article! I really like it.
But how the hell do I send a text message from my phone to an emailadress? I only have an old siemens A60 wich does little more then sending text messages (SMS) and phoning some friends. When I send an SMS I can only put in the phone numer of someone as far as I know. How can I put in a gmail-adress? Do I need something like the iPhone to do this? Sry for my stupidity, just hope someone can help me!
Edit: Well, after some googling I found out that there are different websites that offer a phone number you can send a message to. In this message you have to first type the emailadress and then the text you want to be sent.


Older phone possibly wont work, im using a Nokia 6110 Navigator, and i can send MMS to my email address, or i can send direct emails. but not an a standard SMS.

#19 daedalus

daedalus

    Hak5 Fan +

  • Members
  • PipPipPip
  • 43 posts

Posted 04 May 2008 - 11:32 AM

I did this from a motorola razr on at&t.  If you are unsure what your phone's email address is, this link: http://www.sms411.ne...l-to-phone.html
may help you figure it out.  With that, you could try 911alertme's suggestion of trying to reply.



daedalus

#20 jmac

jmac

    Hak5 Fan +

  • Active Members
  • PipPipPip
  • 44 posts
  • Gender:Male
  • Location:Dayton, Ohio

Posted 05 May 2008 - 07:01 PM

Daedalus: Nice guide, that is really cool...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users