iTEYE

Strace for MacOSX (dtruss)

25 июля 2013

For some reasons, sometimes we want to use on . But is absent in . It not sad thing, because we can use !

In this example we try to script under .

At first we try to connect to server with telnet:

Second step is:
After that we open another tab of and use lsof command:

Search «telnet…TCP localhost:49931->localhost:http (ESTABLISHED)».
We need 49931.

In third step:
We use lsof instead of netstat.
sudo lsof -Pn | grep 49933 — on
netstat -nap | grep 49933 — on linux
Search «httpd 1155 _www…TCP 127.0.0.1:80->127.0.0.1:49933 (ESTABLISHED)».
We need 1155.

The final step is:
sudo dtruss -aeodf -p 1156 -n php — on
strace -o /tmp/output.txt -f -r -s4096 -p 1155 — on Linux

After that we need to switch to first tab (with telnet) and type:

Where second parameter (/?parent=509) is our script address. It can be /script. for example.
Finally tap Return twice.

After that you can abort connection and switch to second tab of and see many lines of .

Enjoy learning ;)

technology, , , , , ,

Leave a Reply

Скидки до 5% на заказ хостинга!