LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-18-2009, 11:32 AM   #1
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Rep: Reputation: 30
Is their a program or script that can execute a command from an email


Is their a way to have my linux box check an email account, look for a specific email from a specific sender and execute a command?
 
Old 03-18-2009, 11:56 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Your question does not match the title...

Quote:
Is their a program or script that can execute a command from an email
I sincerely hope not....

Quote:
Is their a way to have my linux box check an email account, look for a specific email from a specific sender and execute a command?
Send a standard command based on the content (or identity of the sender) of email? Sure.
 
Old 03-18-2009, 02:30 PM   #3
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Some ticketing systems do something like this.. of course it depends on the type of command you wish to execute.

for example. OTRS2 -

User sends email to helpdesk@mycompany.com

OTRS2 polls the email server and retrieves email that was sent to it.
OTRS then evaluates the message for certain criteria (from address, Subject keywords, etc.. ) and decides Which queue it belongs in, updates the database, possibly sends out a notification to the tech.

I believe OTRS is written mostly in perl.

Not sure what you are trying to accomplish, explaining a bit more about your goals might make it more clear.
 
Old 03-18-2009, 03:02 PM   #4
hedgy102
Member
 
Registered: Mar 2009
Distribution: Debian,Centos
Posts: 30

Rep: Reputation: 16
Don't know if you are trying to write your own solution but http://search.cpan.org/~simon/Mail-Audit-2.1/Audit.pm might help.
 
Old 03-18-2009, 05:45 PM   #5
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Original Poster
Rep: Reputation: 30
Ok, maybe I should be more clear.

Say I send an email to xyz@email.com, the linux box would monitor this account, and say when it saw a message from me@email.com, and if the email had a specific line (ie: where are you), it would then reaply to that email with some info (my ip is: 123.123.123.123), or also run a command like reboot, halt...

Can this be done?
 
Old 03-18-2009, 05:49 PM   #6
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Is there some reason your post shouldn't be seen as an attempt to get information about hacking someone else's system?
 
Old 03-18-2009, 06:03 PM   #7
hedgy102
Member
 
Registered: Mar 2009
Distribution: Debian,Centos
Posts: 30

Rep: Reputation: 16
I can think of several ways to do this but no turnkey solution.

Are you willing to write something yourself?

Otherwise, I got the impression that you have a dynamic IP and trying to find a way to reach your computer remotely. If this is the case then you could use a service like http://www.dyndns.com. They provide a free service that does just that.
 
Old 03-18-2009, 06:52 PM   #8
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Quakeboy02 View Post
Is there some reason your post shouldn't be seen as an attempt to get information about hacking someone else's system?
Why does it sound like I want to hack in to some else's system? Emailing my box (note not someone elses) a command does not make it hack someone else. Besides, don;t you think that if I am asking this question here, its because I don't know how to do it, and if I could hack someone, I would probably know how to do this anyway?

Quote:
Are you willing to write something yourself?
I don't know much about writing in linux. If I had a working example, I might be able to reverse it and learn from it.

Any ideas?
 
Old 03-18-2009, 07:21 PM   #9
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
Quote:
Originally Posted by pixellany View Post
Your question does not match the title...

Quote:
Is their a program or script that can execute a command from an email
I sincerely hope not....
Lol. The OP should look into MS Outlook.

Quote:
~$ fortune
Look Out! It's Microsoft Outlook

An old maxim in the Unix community states, "All programs expand until they
can read mail... except Microsoft Outlook." Well, that's no longer true.
By taking advantage of loopholes in several undocumented APIs, a team of
geeks were able to transform Outlook from a virus-delivery system into an
actual mail client.

"It was quite a feat to accomplish this," said one of the geeks. "I mean,
the rat's nest that is the Windows API can be used to frighten small
children... or adults. And the frequency by which Outlook exploits are
discovered is directly proportional to the number of times Bill Gates uses
the word 'innovation'. But this is the first time somebody has discovered
a beneficial exploit."

Microsoft has vowed to release a patch to fix the uncovered security
flaws. "We simply cannot tolerate unauthorized reverse engineering and
hacking of our innovative solutions. Our Security Response Team will pull
an all-nighter to eliminate these known issues."
 
Old 03-18-2009, 07:28 PM   #10
hedgy102
Member
 
Registered: Mar 2009
Distribution: Debian,Centos
Posts: 30

Rep: Reputation: 16
I don't have any real turnkey solution in mind.

Along with the library I suggested earlier, fetchmail might also come in handy. But you will most likely have to spend some time learning your way around before putting together something functional.
 
Old 03-18-2009, 08:04 PM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by SuperDude123 View Post
Is their a way to have my linux box check an email account, look for a specific email from a specific sender and execute a command?
Something like http://freshmeat.net/projects/mail2sh ?
 
Old 03-18-2009, 08:15 PM   #12
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Original Poster
Rep: Reputation: 30
How would you implement mail2sh to execute a command from an email?
 
Old 03-18-2009, 08:21 PM   #13
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
you might be better off setting up a dyndns registration from www.dyndns.com to your computer and setting up webmin (www.webmin.com), then there are scripts that automatically update your dyndns information automatically, that way you can have a web interface at mycomp.homelinux.com and just launch a web browser to mycomp.homelinux.com:10000 and have nearly full control of your box
if you don't need a full web interface then a portable version of putty on a thumb drive and setting up ssh access and ssh using putty to mycomp.homelinux.com would work too

Last edited by frieza; 03-18-2009 at 08:25 PM.
 
Old 03-18-2009, 08:29 PM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by SuperDude123 View Post
How would you implement mail2sh to execute a command from an email?
How far are you with the installation? Did you actually download the tarball and peruse the contents?
 
Old 03-18-2009, 08:30 PM   #15
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Original Poster
Rep: Reputation: 30
Quote:
you might be better off setting up a dyndns registration from www.dyndns.com to your computer and setting up webmin (www.webmin.com), then there are scripts that automatically update your dyndns information automatically, that way you can have a web interface at mycomp.homelinux.com and just launch a web browser to mycomp.homelinux.com:10000 and have nearly full control of your box
if you don't need a full web interface then a portable version of putty on a thumb drive and setting up ssh access and ssh using putty to mycomp.homelinux.com would work too
The idea of emailing was so I could send it from my mobile, and I know I can't SSH with my mobile.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C program code to execute linux-command supermichou_fr Linux - Software 4 08-01-2012 09:25 AM
Execute command upon every string that gets outputed from a program Tomás Ó hÉilidhe Linux - General 7 12-05-2008 05:04 AM
want to execute edquota command inside a c program admirelinux Linux - Newbie 3 11-11-2008 12:11 AM
Execute a linux command using a java program tvalenzuela Programming 2 10-07-2005 12:59 PM
execute command when program closes frieza Linux - Software 3 11-17-2003 06:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration