ClericPy / ichrome

Chrome controller for Humans, based on Chrome Devtools Protocol(CDP) and python3.7+.
https://pypi.org/project/ichrome/
MIT License
228 stars 29 forks source link

How could I show some local variables in javascript with ichrome? #48

Closed Champollion9012 closed 2 years ago

Champollion9012 commented 3 years ago

Sorry, I know this question that is related to Chrome DevTools Protocol. But, I help you can help me. :(

I'd like to get some local variables in a javascript function. My idea is setting some breakpoints, executing and then showing the debugger.scope to capture the local variables. However, I don't know how to start with ichrome....

ClericPy commented 3 years ago

That's a good question. Someone asked me last year, but I didn't try that yet. Maybe you can find the objectId of local or closure functions by cdp.

Years before, I tried using Fetch method as a Man-in-the-middle (MITM) attacks to update those JS functions, and then add new hook code to them.

Champollion9012 commented 3 years ago

Thank for reply. Fetch is https://chromedevtools.github.io/devtools-protocol/tot/Fetch/? If it's, which method you would suggest? could you give me more concrete details? And How to capture the objectId? Sorry, I'm an newbie.

ClericPy commented 3 years ago

Yup, Fetch could modify the response.

objectId you can learn it from google, I didn't use that before.