Re: Bash: How to extract an executable from within?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-09-14 at 21:39 -0700, Daniel B. Thurman wrote:
> Still - I wondered why cat/echo would not work
> under such a scenario when there is ELF code
> involved.  I attempted to look at 'printf' but
> could not figure it out.
> 
> How would you do it, really?

Since you haven't shown in detail what you're actually doing, it's hard
to say.

"cat" just sends stuff to its standard output and is completely
agnostic, but using it in an inline script will work only as long as the
end-of-file sequence ("EOF" in your example) doesn't occur on the input
stream.

"echo" is not one thing (there are different variants, some are Shell
builtins, others are actual programs) but they all assume that input is
printable, so any embedded nulls are going to cause problems, plus it
will interpret escape sequences. Both of these will almost certainly
damage a large binary file, not just ELF. Not to mention the fact that
"echo" takes its input from the command line, which is probably going to
hit system limits on argument size.

Whenever I've seen this kind of thing, the input is not a binary file.
It's encoded in some way (e.g. uuencode) and decoded while being
written, i.e. the input is strict ASCII and the output can be anything.

As someone else suggested, take a look at 'shar'.

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux