Unix Shell - Detect if a program is being traced

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2005 > Detect if a program is being traced





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Detect if a program is being traced
chengiz@my-deja.com

2005-02-25, 5:59 pm

Is there any way for a (C) program to figure out whether it is being
traced... perhaps a unistd function?

Is there any way the shell can figure out whether a given program is
being traced?

Thank you.
Khan

Bill Marcum

2005-02-25, 5:59 pm

On 25 Feb 2005 11:10:24 -0800, chengiz@my-deja.com
<chengiz@my-deja.com> wrote:
> Is there any way for a (C) program to figure out whether it is being
> traced... perhaps a unistd function?
>
> Is there any way the shell can figure out whether a given program is
> being traced?
>


For a shell script:
case $- in
*x*) echo "Don't look now but I think we're being followed!" ;;
esac
chengiz@my-deja.com

2005-02-25, 5:59 pm


> For a shell script:
> case $- in
> *x*) echo "Don't look now but I think we're being followed!" ;;
> esac


Sorry, I meant a running C program. I want either the program to be
able to figure out itself whether it is being traced, and/or the shell
to figure out whether the program is being traced. Thanks.

Khan

Icarus Sparry

2005-02-25, 8:47 pm

On Fri, 25 Feb 2005 15:48:27 -0800, chengiz wrote:

>
>
> Sorry, I meant a running C program. I want either the program to be
> able to figure out itself whether it is being traced, and/or the shell
> to figure out whether the program is being traced. Thanks.


The first question must be 'Why?'.
The next is 'What operating system?'


Alan Connor

2005-02-26, 2:50 am

On Fri, 25 Feb 2005 16:13:15 -0500, Bill Marcum
<bmarcum@iglou.com.urgent> wrote:

> On 25 Feb 2005 11:10:24 -0800, chengiz@my-deja.com
> <chengiz@my-deja.com> wrote:
>
>
>
> For a shell script: case $- in *x*) echo "Don't look now but I
> think we're being followed!" ;; esac


:-)


AC


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com