Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Faith: not *wanting* to know what is true." -- Friedrich Nietzsche


devel / comp.unix.shell / Find the pid of the application launched by proxychains-ng.

SubjectAuthor
* Find the pid of the application launched by proxychains-ng.hongy...@gmail.com
+- Re: Find the pid of the application launched by proxychains-ng.Janis Papanagnou
`* Re: Find the pid of the application launched by proxychains-ng.Kenny McCormack
 `* Re: Find the pid of the application launched by proxychains-ng.Janis Papanagnou
  +* Re: Find the pid of the application launched by proxychains-ng.Kenny McCormack
  |`- Re: Find the pid of the application launched by proxychains-ng.Janis Papanagnou
  `* Re: Find the pid of the application launched by proxychains-ng.hongy...@gmail.com
   `- Re: Find the pid of the application launched by proxychains-ng.hongy...@gmail.com

1
Find the pid of the application launched by proxychains-ng.

<32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4339&group=comp.unix.shell#4339

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:a554:: with SMTP id o81mr5673837qke.231.1631452630517;
Sun, 12 Sep 2021 06:17:10 -0700 (PDT)
X-Received: by 2002:a37:ab12:: with SMTP id u18mr5516334qke.516.1631452630312;
Sun, 12 Sep 2021 06:17:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 12 Sep 2021 06:17:10 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=8.210.184.1; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 8.210.184.1
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
Subject: Find the pid of the application launched by proxychains-ng.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Sun, 12 Sep 2021 13:17:10 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 10
 by: hongy...@gmail.com - Sun, 12 Sep 2021 13:17 UTC

See the following example:

$ proxychains-ng-http google-chrome >/dev/null 2>&1 &
[1] 2226205
$ wmctrl -lp | grep 'Google Chrome'
0x00400020 0 1458872 X10DAi-00 New Tab - Google Chrome

What's the relationship between 2226205 and 1458872? Is it possible to find the PID of the application, i.e., 1458872, launched by proxychains-ng based on the background proxychains-ng PID, i.e., 2226205?

Regards,
HY

Re: Find the pid of the application launched by proxychains-ng.

<shkv96$r87$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4340&group=comp.unix.shell#4340

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!I4G2pI/TjSgw9iO3pv/WTg.user.46.165.242.75.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Find the pid of the application launched by proxychains-ng.
Date: Sun, 12 Sep 2021 15:28:06 +0200
Organization: Aioe.org NNTP Server
Message-ID: <shkv96$r87$1@gioia.aioe.org>
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="27911"; posting-host="I4G2pI/TjSgw9iO3pv/WTg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Notice: Filtered by postfilter v. 0.9.2
 by: Janis Papanagnou - Sun, 12 Sep 2021 13:28 UTC

On 12.09.2021 15:17, hongy...@gmail.com wrote:
> See the following example:
>
> $ proxychains-ng-http google-chrome >/dev/null 2>&1 & [1] 2226205 $
> wmctrl -lp | grep 'Google Chrome' 0x00400020 0 1458872 X10DAi-00 New
> Tab - Google Chrome
>
> What's the relationship between 2226205 and 1458872? Is it possible
> to find the PID of the application, i.e., 1458872, launched by
> proxychains-ng based on the background proxychains-ng PID, i.e.,
> 2226205?

If you are effectively asking whether you can find the parent of a
process given the PIDs then yes, that's possible by using ps(1).

$ ps -o ppid,pid
PPID PID
22673 14283
22488 22673

Janis

>
> Regards, HY
>

Re: Find the pid of the application launched by proxychains-ng.

<shkvpj$20iav$1@news.xmission.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4341&group=comp.unix.shell#4341

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: Find the pid of the application launched by proxychains-ng.
Date: Sun, 12 Sep 2021 13:36:51 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <shkvpj$20iav$1@news.xmission.com>
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
Injection-Date: Sun, 12 Sep 2021 13:36:51 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2115935"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sun, 12 Sep 2021 13:36 UTC

In article <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>,
hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>See the following example:
>
>$ proxychains-ng-http google-chrome >/dev/null 2>&1 &
>[1] 2226205
>$ wmctrl -lp | grep 'Google Chrome'
>0x00400020 0 1458872 X10DAi-00 New Tab - Google Chrome
>
>What's the relationship between 2226205 and 1458872? Is it possible
>to find the PID of the application, i.e., 1458872, launched by
>proxychains-ng based on the background proxychains-ng PID, i.e., 2226205?

I use the following shell function in my scripts:

# usage: childpid=$(getpid <parentPid> <program2search4>)
getpid() {
pstree -p $1 | gawk 'NF > 1 { print $2+0 }' FS="-($2)[(]"
}

The idea is that you could just use "pidof" (or "pgrep" or whatever), but
that searches globally - i.e., searches all the processes on the system.
What you want is a version of "pidof" that only searches the children of a
given process ID. The above function does that.

P.S. Doncha just love these new 7_or_8-digit-PIDs? The system I'm typing
on now recently upgraded to using them. Crazy, man!

--
Never, ever, ever forget that "Both sides do it" is strictly a Republican meme.

It is always the side that sucks that insists on saying "Well, you suck, too".

Re: Find the pid of the application launched by proxychains-ng.

<shl07u$1amq$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4342&group=comp.unix.shell#4342

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!I4G2pI/TjSgw9iO3pv/WTg.user.46.165.242.75.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Find the pid of the application launched by proxychains-ng.
Date: Sun, 12 Sep 2021 15:44:30 +0200
Organization: Aioe.org NNTP Server
Message-ID: <shl07u$1amq$1@gioia.aioe.org>
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
<shkvpj$20iav$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="43738"; posting-host="I4G2pI/TjSgw9iO3pv/WTg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Notice: Filtered by postfilter v. 0.9.2
 by: Janis Papanagnou - Sun, 12 Sep 2021 13:44 UTC

On 12.09.2021 15:36, Kenny McCormack wrote:
> In article <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>,
> hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>> See the following example:
>>
>> $ proxychains-ng-http google-chrome >/dev/null 2>&1 &
>> [1] 2226205
>> $ wmctrl -lp | grep 'Google Chrome'
>> 0x00400020 0 1458872 X10DAi-00 New Tab - Google Chrome
>>
>> What's the relationship between 2226205 and 1458872? Is it possible
>> to find the PID of the application, i.e., 1458872, launched by
>> proxychains-ng based on the background proxychains-ng PID, i.e., 2226205?
>
> I use the following shell function in my scripts:
>
> # usage: childpid=$(getpid <parentPid> <program2search4>)
> getpid() {
> pstree -p $1 | gawk 'NF > 1 { print $2+0 }' FS="-($2)[(]"
> }
>
> The idea is that you could just use "pidof" (or "pgrep" or whatever), but
> that searches globally - i.e., searches all the processes on the system.
> What you want is a version of "pidof" that only searches the children of a
> given process ID. The above function does that.

What's the advantage of the complex pstree-based function compared to
just using ps(1) ?

$ ps h --ppid 22575 -o pid
1764
31254

Janis

Re: Find the pid of the application launched by proxychains-ng.

<shl1rd$20iav$2@news.xmission.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4343&group=comp.unix.shell#4343

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: Find the pid of the application launched by proxychains-ng.
Date: Sun, 12 Sep 2021 14:11:57 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <shl1rd$20iav$2@news.xmission.com>
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com> <shkvpj$20iav$1@news.xmission.com> <shl07u$1amq$1@gioia.aioe.org>
Injection-Date: Sun, 12 Sep 2021 14:11:57 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2115935"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sun, 12 Sep 2021 14:11 UTC

In article <shl07u$1amq$1@gioia.aioe.org>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
....
>What's the advantage of the complex pstree-based function compared to
>just using ps(1) ?
>
>$ ps h --ppid 22575 -o pid
> 1764
>31254

A couple of things come to mind:

1) I think you and I read OP's requirements differently. So, we (you & I)
seem to be solving different problems. Of course, only time will tell
which of us (if any) read it correctly.

2) ps is a mess. It has become such a joke over the years, trying to
support every possible version that's ever been written, that I try to
avoid it. I had no idea that any of the options you list above even
existed (and I've been using Unix and ps for far too long...)

--
You are a dreadful man, Kenny, for all your ways are the ways of death.
- Rick C Hodgin -

(P.S. -> https://www.youtube.com/watch?v=sMmTkKz60W8)

Re: Find the pid of the application launched by proxychains-ng.

<shlfdm$n40$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4344&group=comp.unix.shell#4344

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!I4G2pI/TjSgw9iO3pv/WTg.user.46.165.242.75.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Find the pid of the application launched by proxychains-ng.
Date: Sun, 12 Sep 2021 20:03:34 +0200
Organization: Aioe.org NNTP Server
Message-ID: <shlfdm$n40$1@gioia.aioe.org>
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
<shkvpj$20iav$1@news.xmission.com> <shl07u$1amq$1@gioia.aioe.org>
<shl1rd$20iav$2@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="23680"; posting-host="I4G2pI/TjSgw9iO3pv/WTg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Notice: Filtered by postfilter v. 0.9.2
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Sun, 12 Sep 2021 18:03 UTC

On 12.09.2021 16:11, Kenny McCormack wrote:
> In article <shl07u$1amq$1@gioia.aioe.org>,
> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> ...
>> What's the advantage of the complex pstree-based function compared to
>> just using ps(1) ?
>>
>> $ ps h --ppid 22575 -o pid
>> 1764
>> 31254
>
> A couple of things come to mind:
>
> 1) I think you and I read OP's requirements differently. So, we (you & I)
> seem to be solving different problems. Of course, only time will tell
> which of us (if any) read it correctly.

I don't think so (but may be wrong). In my first post I just formulated
it as seen from the children ("what is a process's parent" instead of
"what are the children of a process"), because I think it's closer to
the understanding that for every Unix process the parent can be directly
identified. And ps(1) connects both from whichever perspective you want
to see it.

>
> 2) ps is a mess. It has become such a joke over the years, trying to
> support every possible version that's ever been written, that I try to
> avoid it. I had no idea that any of the options you list above even
> existed (and I've been using Unix and ps for far too long...)

While ps was always a mess - I agree here - meanwhile they incorporated
options from any variant plus maybe new ones and --long-option-versions.
True. For the large Linux community this means in consequence that you
find whatever you want! The very useful -o to define only those fields
that you actually want stems from AIX and is so useful that you see
similar behaving options now in other commands as well. The dash-less
'h' is an old style one (that can be found in commands with an older
history), here mixed with the dash-form options and the long-forms;
there's often options available that suppress the output data header.
That there's a --ppid (at least in Linux' ps version) I just suspected
and indeed found it in the man page. Otherwise I would have resorted
instead of
ps h --ppid 22575 -o pid
to the still very clear
ps -o ppid,pid | awk '$1==22575 {print $2}'

Actually I think that with the "specify desired output" -o option and
the "define what you are refering to" --ppid option it supports very
clean interfaces without ballast. Just imagine the (even greater) mess
in former times where every platform has its own incompatible version.
Now you have it all in one at least and need not resort to other tools
in most cases.

Where we indeed prefer different approaches is that I avoid parsing
graphical tools (like pstree) when tools are available that provide
easier parseable tabular data.

Janis

Re: Find the pid of the application launched by proxychains-ng.

<7e615c62-0644-4401-805e-38763a81ef61n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4348&group=comp.unix.shell#4348

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ac8:7f52:: with SMTP id g18mr7174356qtk.169.1631494513680;
Sun, 12 Sep 2021 17:55:13 -0700 (PDT)
X-Received: by 2002:a0c:d450:: with SMTP id r16mr8135740qvh.30.1631494513413;
Sun, 12 Sep 2021 17:55:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 12 Sep 2021 17:55:13 -0700 (PDT)
In-Reply-To: <shl07u$1amq$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=172.104.119.69; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.104.119.69
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
<shkvpj$20iav$1@news.xmission.com> <shl07u$1amq$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7e615c62-0644-4401-805e-38763a81ef61n@googlegroups.com>
Subject: Re: Find the pid of the application launched by proxychains-ng.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 13 Sep 2021 00:55:13 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 52
 by: hongy...@gmail.com - Mon, 13 Sep 2021 00:55 UTC

On Sunday, September 12, 2021 at 9:44:35 PM UTC+8, Janis Papanagnou wrote:
> On 12.09.2021 15:36, Kenny McCormack wrote:
> > In article <32c46650-de8a-4c4d...@googlegroups.com>,
> > hongy...@gmail.com <hongy...@gmail.com> wrote:
> >> See the following example:
> >>
> >> $ proxychains-ng-http google-chrome >/dev/null 2>&1 &
> >> [1] 2226205
> >> $ wmctrl -lp | grep 'Google Chrome'
> >> 0x00400020 0 1458872 X10DAi-00 New Tab - Google Chrome
> >>
> >> What's the relationship between 2226205 and 1458872? Is it possible
> >> to find the PID of the application, i.e., 1458872, launched by
> >> proxychains-ng based on the background proxychains-ng PID, i.e., 2226205?
> >
> > I use the following shell function in my scripts:
> >
> > # usage: childpid=$(getpid <parentPid> <program2search4>)
> > getpid() {
> > pstree -p $1 | gawk 'NF > 1 { print $2+0 }' FS="-($2)[(]"
> > }
> >
> > The idea is that you could just use "pidof" (or "pgrep" or whatever), but
> > that searches globally - i.e., searches all the processes on the system.
> > What you want is a version of "pidof" that only searches the children of a
> > given process ID. The above function does that.
> What's the advantage of the complex pstree-based function compared to
> just using ps(1) ?
>
> $ ps h --ppid 22575 -o pid
> 1764
> 31254

The wrapper script ``proxychains-ng-http'':

#!/usr/bin/env bash
proxychains_conf=/path/to/proxychains-ng-http.conf
if type -fp proxychains4 >/dev/null; then
exec proxychains4 -q -f $proxychains_conf "$@"
fi

The testing:

werner@X10DAi-00:~$ proxychains-ng-http google-chrome >/dev/null 2>&1 &
[1] 4069773
0x00400031 0 3657396 X10DAi-00 New Tab - Google Chrome
werner@X10DAi-00:~$ wmctrl -lp |grep -i 'chrome'
0x00400031 0 3657396 X10DAi-00 New Tab - Google Chrome
werner@X10DAi-00:~$ ps h --ppid 4069773 -o pid
werner@X10DAi-00:~$

HY

Re: Find the pid of the application launched by proxychains-ng.

<2aebb160-ea45-44da-aa98-a1f19765f279n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4350&group=comp.unix.shell#4350

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a0c:f552:: with SMTP id p18mr8475439qvm.44.1631497732415;
Sun, 12 Sep 2021 18:48:52 -0700 (PDT)
X-Received: by 2002:a0c:b41d:: with SMTP id u29mr8523090qve.51.1631497732244;
Sun, 12 Sep 2021 18:48:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 12 Sep 2021 18:48:52 -0700 (PDT)
In-Reply-To: <7e615c62-0644-4401-805e-38763a81ef61n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.232; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.232
References: <32c46650-de8a-4c4d-9a84-0bfdf31e979fn@googlegroups.com>
<shkvpj$20iav$1@news.xmission.com> <shl07u$1amq$1@gioia.aioe.org> <7e615c62-0644-4401-805e-38763a81ef61n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2aebb160-ea45-44da-aa98-a1f19765f279n@googlegroups.com>
Subject: Re: Find the pid of the application launched by proxychains-ng.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 13 Sep 2021 01:48:52 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 60
 by: hongy...@gmail.com - Mon, 13 Sep 2021 01:48 UTC

On Monday, September 13, 2021 at 8:55:16 AM UTC+8, hongy...@gmail.com wrote:
> On Sunday, September 12, 2021 at 9:44:35 PM UTC+8, Janis Papanagnou wrote:
> > On 12.09.2021 15:36, Kenny McCormack wrote:
> > > In article <32c46650-de8a-4c4d...@googlegroups.com>,
> > > hongy...@gmail.com <hongy...@gmail.com> wrote:
> > >> See the following example:
> > >>
> > >> $ proxychains-ng-http google-chrome >/dev/null 2>&1 &
> > >> [1] 2226205
> > >> $ wmctrl -lp | grep 'Google Chrome'
> > >> 0x00400020 0 1458872 X10DAi-00 New Tab - Google Chrome
> > >>
> > >> What's the relationship between 2226205 and 1458872? Is it possible
> > >> to find the PID of the application, i.e., 1458872, launched by
> > >> proxychains-ng based on the background proxychains-ng PID, i.e., 2226205?
> > >
> > > I use the following shell function in my scripts:
> > >
> > > # usage: childpid=$(getpid <parentPid> <program2search4>)
> > > getpid() {
> > > pstree -p $1 | gawk 'NF > 1 { print $2+0 }' FS="-($2)[(]"
> > > }
> > >
> > > The idea is that you could just use "pidof" (or "pgrep" or whatever), but
> > > that searches globally - i.e., searches all the processes on the system.
> > > What you want is a version of "pidof" that only searches the children of a
> > > given process ID. The above function does that.
> > What's the advantage of the complex pstree-based function compared to
> > just using ps(1) ?
> >
> > $ ps h --ppid 22575 -o pid
> > 1764
> > 31254
> The wrapper script ``proxychains-ng-http'':
>
> #!/usr/bin/env bash
> proxychains_conf=/path/to/proxychains-ng-http.conf
> if type -fp proxychains4 >/dev/null; then
> exec proxychains4 -q -f $proxychains_conf "$@"
> fi
>
>
> The testing:
>
> werner@X10DAi-00:~$ proxychains-ng-http google-chrome >/dev/null 2>&1 &
> [1] 4069773
> 0x00400031 0 3657396 X10DAi-00 New Tab - Google Chrome
> werner@X10DAi-00:~$ wmctrl -lp |grep -i 'chrome'
> 0x00400031 0 3657396 X10DAi-00 New Tab - Google Chrome
> werner@X10DAi-00:~$ ps h --ppid 4069773 -o pid
> werner@X10DAi-00:~$

Got it. If there is already a Chrome session, it will be shared instead of creating a new session from scratch:

$ pkill chrome
$ proxychains-ng-http google-chrome >/dev/null 2>&1 &
[2] 1097863
$ wmctrl -lp |grep -i 'chrome'
0x02000003 0 1097863 X10DAi-00 New Tab - Google Chrome

HY

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor