Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fancy45daddy opened this issue Feb 8, 2024 · 6 comments
Closed
Labels
question Further information is requested

Comments

@fancy45daddy
Copy link

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

@cfc4n
Copy link
Member

cfc4n commented Feb 8, 2024

please mark sure which tls library nodejs/python used.

more info: #346

@cfc4n cfc4n added the question Further information is requested label Feb 8, 2024
@fancy45daddy
Copy link
Author

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?

@cfc4n
Copy link
Member

cfc4n commented Feb 15, 2024

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.

@fancy45daddy
Copy link
Author

For nodejs, any idea to fix the problem?

@cfc4n
Copy link
Member

cfc4n commented Feb 16, 2024

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
Copy link
Member

cfc4n commented Feb 23, 2024

No response for more than 7 days

@cfc4n cfc4n closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants