Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Charles monitor terminal request

Is there any way to monitor request of application such as terminal? Now I can monitor chrome but other application not.

My charles's version is 4.2

like image 664
CoXier Avatar asked Dec 14 '17 07:12

CoXier


People also ask

How do I check my Charles request?

Viewing Requests There are two different ways of viewing the session window: structure view and sequence view. Structure view lets you view the requests in a tree organised by the host name and then folders/directories within the host. Sequence view lets your view the requests in the sequence that they occur.

How do I read a Charles proxy log?

Check the proxy configuration. Open Charles Proxy, if it is not already open. Open your mobile device's browser and navigate to a site. Grant access when prompted that a device is trying to connect to your network. You should now see your mobile device's traffic in your Charles Sequence log.

How do I use Charles Proxy on Mac?

Open Settings, tap Wi-Fi and verify you're connected to the same network as your computer. Then, tap the ⓘ button next to your Wi-Fi network. Scroll down to the HTTP Proxy section, select Configure Proxy and then tap Manual. Enter your Mac's IP address for Server and the Charles HTTP Proxy port number for Port.

How do I view JSON in Charles?

After completing charles session you can launch http://control.charles/session/export-json url to get the JSON format of the request.


1 Answers

I think it depends on the command line you are trying to monitor. To purely capture http requests made from terminals you just need to set the environment variable 'http_proxy' such as:

$ export http_proxy="http://localhost:8888"
$ curl "http://www.google.com"

This will make Charles capture the HTTP request to Google, but this may not happen with all applications started from this terminal. You'll probably have to find the way to configure the proxy on those other applications.

Just as an example, if you want to capture http requests from a java application you are developing, you will need to add the proper proxy configuration to the java command line, something like:

$ JAVA_FLAGS="-Dhttp.proxyHost=localhost -Dhttp.proxyPort=8888 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8888"
$ java $JAVA_FLAGS ...

To enable HTTPS sniffing with Charles you will need to add the certificate to the JVM's keystore with:

$ keytool -import -alias charles -file charles-ssl-proxying-certificate.cer -keystore $JAVA_HOME/jre/lib/security/cacerts

Please, notice that

  • the cacerts file location may vary depending on the java version (on Java 10 it's under $JAVA_HOME/lib/security/)
  • the password for the cacerts file, if unchanged, is: changeit (so consider changing it)

Hope this helps.

like image 158
Lluís Suñol Avatar answered Sep 20 '22 23:09

Lluís Suñol