gojue/ecapture

how to use ecapture with nodejs fetch and python urllib.request

fancy45daddy opened this issue · 6 comments

I want to capture the http traffic in nodejs fetch and python urllib.request
run

sudo ecapture tls

first
then in node run

await globalThis.fetch('https://httpbin.org/ip').then(_ => _.json())

and ipython run

from urllib.request import urlopen
with urlopen("https://httpbin.org/ip") as response:
    print(response.read())

But I do not see anything print out under sudo ecapture tls, please help

please mark sure which tls library nodejs/python used.

more info: #346

for nodejs, I run LD_DEBUG=libs node and then

await globalThis.fetch('https://httpbin.org/ip').then(_ => _.json())
find library=libnss_mdns4_minimal.so.2 [0]; searching
    225365:	 search cache=/etc/ld.so.cache
    225365:	  trying file=/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
    225365:	
    225365:	
    225365:	calling init: /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2

how to hook libnss_mdns4_minimal.so.2 in ecapture?

For python3, You said Python uses libssl.so to initiate HTTPS requests, but not the SSL_write function, instead it uses the SSL_write_ex function. The current version of eCapture has removed the HOOK code for the SSL_write_ex function. You can restore it yourself and then compile it again. Is there anyway not to recompile but pass parameter to ecapture command line?

Sorry, I have been on vacation recently and replied a bit late.

Currently, it is not possible to fix this issue through command line parameters.

The parameters of eCapture are already numerous, and there is no intention to add any more parameters.

For nodejs, any idea to fix the problem?

try ecapture nss --nspr=/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2 .

If it still doesn't work, then you'll need to write the code yourself.

No response for more than 7 days