methods for putting labels into your software?

James A. Mullens mullens at jamsun.ic.ornl.gov
Thu Jun 27 08:04:28 AEST 1991


In article <1991Jun26.194059.19047 at thyme.jpl.nasa.gov>, kaleb at thyme.jpl.nasa.gov (Kaleb Keithley) writes:
|> In article  mullens at jamsun.ic.ornl.gov (James A. Mullens) writes:
|> >In article  mlevin at jade.tufts.edu writes:
|> >|> 
|> >|>    I'd like to hear suggestions, or any tricks that the pros out there
|> >|> know about, for putting some kind of text label or code into your
|> >|> executable (compiled and linked from C code) so that if anyone were to
|> >
|> >How about a static long int initialized to your social security
|> >number?  To make finding it in a binary file easier you might
|> >declare a struct with 2 or 3 such unique numbers, but I think most
|> >people's social security number would be unique enough by itself.
|> >
|> 
|> How about little-endian vs. big-endian architectures?  What looks like
|> your SSN on one machine would surely be scrambled on another.  Same
|> for text strings coded as long ints.

If your program to detect the SSN were compiled on the same architecture
as the executable you are trying to scan, you just define it in the same
way -- the byte ordering takes care of itself.

|>  For that matter, how do you go
|> about locating an arbitrary integer within some binary?

It think you just read the file as a stream of bytes and check for the
SSN byte sequence, starting at every byte in the file (except the last 3 :-).

|>  I'll wager I could
|> find my social security number buried in binaries all over the place.

This depends entirely on your SSN.  If it happens to match a commonly
used sequence of machine instructions (like a return) then you are out
of luck.  A quickie calculation, assuming a random SSN and an executable
consisting of random bytes, tells me there is a 99% chance that a 1 Mb
executable will not contain a particular SSN.  But hey, I could be wrong
and I'm not about to accept your wager!

Those with SSN of 000-00-0000 need not try this.

--
jim mullens
oak ridge national laboratory
mullens at jamsun.ic.ornl.gov (128.219.64.31)
615-574-5564



More information about the Comp.unix.programmer mailing list