Xref: utzoo comp.unix.programmer:2152 comp.lang.c:40507 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!utkcs2!jamsun.ic.ornl.gov!mullens From: mullens@jamsun.ic.ornl.gov (James A. Mullens) Newsgroups: comp.unix.programmer,comp.lang.c Subject: Re: methods for putting labels into your software? Message-ID: <1991Jun26.220428.1812@cs.utk.edu> Date: 26 Jun 91 22:04:28 GMT References: <1991Jun26.165609.9692@athena.mit.edu> <1991Jun26.192319.26495@cs.utk.edu> <1991Jun26.194059.19047@thyme.jpl.nasa.gov> Sender: usenet@cs.utk.edu (USENET News Poster) Distribution: usa Organization: Univ of TN, Knoxville - CS Department Lines: 45 In article <1991Jun26.194059.19047@thyme.jpl.nasa.gov>, kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) writes: |> In article mullens@jamsun.ic.ornl.gov (James A. Mullens) writes: |> >In article mlevin@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@jamsun.ic.ornl.gov (128.219.64.31) 615-574-5564