Introduction
------------
This is binstats 1.00 - an administration utility for tracking down the
various types of binary formats for Linux (i386) executables and their
dynamic library dependencies and also executable scripts.

Features include:
 1) tally of a.out and ELF binaries, dynamically and statically linked,
    unstripped and setuid
 2) tally of Java bytecode binaries (if you run file-3.20+)
 3) tally of text files distinguishing between Bourne, bash and [T]C shells,
    other interpreted scripts, perl scripts & unidentified texts
 4) tally of duplicated executable names
 5) tally of binaries with missing dynamic libraries
 6) tally of DLL and ELF dynamic libraries, used and unused
 7) a log of all the above tallies plus listing a.out binaries, statically
    linked binaries, unstripped binaries, setuid binaries, duplicated
    executables, missing library binaries, all unidentified text files,
    all used and unused dynamic libraries
 8) a C program that dereferences symbolic links
 9) a command line interface(!)

It is inspired by "execount" written by Murple (murple@clark.net)
<URL:ftp://sunsite.unc.edu/pub/Linux/utils/scripts/>.

Technical details
-----------------
Binstats has been written as a bash script utilising the following common
unix tools: echo, tr, cat, xargs, cut, dirname, sed, find, sort, uniq, grep,
file, ldd, awk, diff, wc, uname, date, whereis.

I have on my machine the following versions: GNU bash 1.14.4(1), GNU
sh-utils 1.12, GNU findutils 4.1, GNU textutils 1.11, GNU grep 2.0, file
3.15, ld.so 1.7.14, Gnu Awk (gawk) 2.15-pl6 and GNU diffutils 2.7. [As
usual, a Linux distribution is indebted to the GNU project for most of these
tools.]

Also binstats has been tested on Redhat 4.1 which contains GNU bash
1.14.7, GNU sh-utils 1.12, GNU findutils 4.1, GNU textutils 1.19, GNU
grep 2.0, file 3.20, ld.so 1.7.14, Gnu Awk (gawk) 3.0.0 and GNU diffutils
2.7.

****File-3.15 & Magic****
-------------------------
For ELF 'not stripped' support, pick up "file 3.15-grr1" plus the patch from
Mitch D'Souza <URL:http://users.ox.ac.uk/~jo95004/patches/file.diff>.
Compile and install accordingly to instructions.

There is a bug in the magic of file-3.15: in Magdir/commands, the six lines
from 40-45 inclusive should be moved to the end.

file-3.20 has ELF 'not stripped' support and Java bytecode support.

Running
-------
Edit the Makefile to suit your setup. Compile and install derefsymlink. Read
the notes in the script before using binstats.

Now you have three options:
   1) leave binstats as is and it will use your PATH and ld.so.conf
   2) edit the variables to fit your system
or 3) use the command line interface

      ./binstats [-b[inaries]="list of executable directories"] [-d[ebug]]
              [-f[ile]=bstats.log] [-h[elp]]
              [-l[ibrary]="list of library directories"]
	      [-p[ath]="usual path for binstats"]
	      [-t[emp]=/tmp] [-v[ersion]]

      For example, if you have a minimal system then try
        ./binstats -b="/bin /sbin /usr/bin /usr/sbin"
      if you only have the four specified directories.

If you don't run it as root then any executable without world readable
status (especially setuid binaries) will register in the tallies or log as
"can't read setuid".

Bugs, etc
---------
Please send any bug reports, patches, etc to me. The latest version can be
found at <URL:http://www.ccc.nottingham.ac.uk/~etzpc/binstats.html>. The
distribution is also archived at
<URL:ftp://sunsite.unc.edu/pub/Linux/utils/scripts/>.

To do
-----
Maybe it's better use Perl [when I read up on it] for all this and get rid
of some 'Linux/i386' dependence (i.e. support COFF, etc.).

Peter.Chang@nottingham.ac.uk

1st April 1997

PS binstats is released under the GPL and as such the usual copyright
conditions and lack of warranty apply.

