<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY>
<DIV>
<DIV><FONT face=Arial size=2><SPAN class=866075116-07052003>OK, I see that it is
time for the definitive answer.</SPAN></FONT></DIV>
<DIV><SPAN class=866075116-07052003></SPAN> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=866075116-07052003><SPAN
class=708395216-07052003>Yennie said:</SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial><SPAN class=866075116-07052003><SPAN
class=708395216-07052003>></SPAN>All these things considered, the only _true_
sign of an executable is the executable flag on the
file.</SPAN></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial><SPAN
class=866075116-07052003></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=866075116-07052003><SPAN
class=708395216-07052003>No, it only determines whether you have permission to
execute the file or not.</SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial><SPAN
class=866075116-07052003></SPAN></FONT></FONT> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>></SPAN>When it really comes down to it, I can
create any file with any name and any extension,</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>></SPAN> type in "chmod +x myFileName", and it
will look just as executable as any other file can.</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT
face=Arial></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>Exactly!, which negates your first
comment.</SPAN><BR><BR><SPAN class=708395216-07052003>But there is a way to get
at "application-style" executables, and that is by using the "file" command,
though the exact output will be somewhat architecture
dependent.</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>Here is its output on a 'C' program I just
compiled:</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>a.out:
ELF 32-bit MSB dynamic executable (not stripped) MIPS - version
1</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>And here is its output when run on the Metacard install
script:</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>install.sh: /bin/sh script
text</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>So, you see it can be used to discriminate between
"application-style" executables and executable scripts. It can also attempt to
determine file types. I'll leave it as an exercise to the reader to determine
how to parse the output to determine if they have an executable or not, perhaps
its the existence of the word 'executable' or maybe 'ELF' but there are other
executable formats as well such as 'COFF'.</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=866075116-07052003><FONT size=2><FONT face=Arial><SPAN
class=708395216-07052003>-Glen</SPAN></FONT></FONT></DIV></SPAN></DIV></BODY></HTML>