[solved] How can i extract Linux command out of e-mail message?

P

postcd

Guest
Hello,

please how can i extract an Linux command out of e-mail message?

I sent an e-mail with this text:
dfgděšřčéáčřéš6356556<='";
pwd: heslo12
cmd: echo "$(date) zzzz";whoami

and in the received e-mail file is:
<div dir=3D"ltr"><h2 id=3D"gmail-:14z" class=3D"gmail-hP" tabindex=3D"-1">d=
fgd=C4=9B=C5=...=99=C3=A9=C5=A1635655<wbr>6=
&lt;=3D&#39;&quot;;</h2><p>pwd: heslo12</p><p>cmd: echo &quot;$(date) =
zzzz&quot;;whoami
</p><p>sdfsd<br></p></div>

The e-mail encoding is:
Content-Type: multipart/alternative
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Please which example command can i use to extract that Linux command out of the mail file not knowing which command the file will contain, only knowing that the command will be after string "cmd: " ?

I am able to extract alphanumeric string, but i do not know how to do what i explained.

Thank You
 
Last edited:


I think this would be quite difficult awk or sed command/s, so i think i will rather make sure e-mail is sent without any special html formating (as a plain text), that way the command seems to remain same as it was typed.
 
Exactly. Change your email program to send plain text and it should send it properly.
 

Staff online

Members online


Top