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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux