ecapture icon indicating copy to clipboard operation
ecapture copied to clipboard

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

Open fancy45daddy opened this issue 1 year ago • 5 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

fancy45daddy avatar Feb 08 '24 02:02 fancy45daddy

please mark sure which tls library nodejs/python used.

more info: https://github.com/gojue/ecapture/issues/346

cfc4n avatar Feb 08 '24 05:02 cfc4n

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?

fancy45daddy avatar Feb 08 '24 23:02 fancy45daddy

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.

cfc4n avatar Feb 15 '24 14:02 cfc4n

For nodejs, any idea to fix the problem?

fancy45daddy avatar Feb 16 '24 02:02 fancy45daddy

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.

cfc4n avatar Feb 16 '24 02:02 cfc4n

No response for more than 7 days

cfc4n avatar Feb 23 '24 11:02 cfc4n