android-emulator-container-scripts icon indicating copy to clipboard operation
android-emulator-container-scripts copied to clipboard

--env http_proxy and --env https_proxy are ignored

Open simkoc opened this issue 3 years ago • 3 comments

I want to intercept the traffic emitted by the container and adapted the docker run to

CONTAINER_ID=us-docker.pkg.dev/android-emulator-268719/images/30-google-x64
docker run --network=host --env http_proxy="http://localhost:8080" --env https_proxy="http://localhost:8080" --device /dev/kvm ${CONTAINER_ID}

However, I do not get any traffic on the port. I have a mitmproxy running on localhost:8080 but I do not get any traffic there. This might be due to the certificate not being accepted even though I use objection. However, I also run tcpdump -i any port 8080 and do not get any traffic on this port.

Are the container doing any network configuration that superseeds the --env directive?

I tested this setup with a vanilla linux container and wget and it works, both with mitm as well as tcpdump output.

simkoc avatar Aug 15 '21 16:08 simkoc

вс, 15 авг. 2021 г., 19:39 Simon Koch @.***>:

I want to intercept the traffic emitted by the container and adapted the docker run to

CONTAINER_ID=us-docker.pkg.dev/android-emulator-268719/images/30-google-x64 docker run --network=host --env http_proxy="http://localhost:8080" --env https_proxy="http://localhost:8080" --device /dev/kvm ${CONTAINER_ID}

However, I do not get any traffic on the port. I have a mitmproxy running on localhost:8080 but I do not get any traffic there. This might be due to the certificate not being accepted even though I use objection https://github.com/sensepost/objection. However, I also run tcpdump -i any port 8080 and do not get any traffic on this port.

Are the container doing any network configuration that superseeds the --env directive?

I tested this setup with a vanilla linux container and wget and it works, both with mitm as well as tcpdump output.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/android-emulator-container-scripts/issues/268, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATQ5T4ROI76BNAIZKWLJY7DT47UUDANCNFSM5CGKYTAA .

tybercylez avatar Aug 15 '21 17:08 tybercylez

Further debugging revealed that the issue is most likely with the startup script /android/sdk/launch_emulator.sh.

When adding the line

var_append LAUNCH_CMD -http-proxy http://127.0.0.1:8080

at the location of the other var_append the interception starts working.

simkoc avatar Aug 16 '21 08:08 simkoc

Ok, looks like we need to fix the mechanism of parameter passing to the emulator through environment variables.

pokowaka avatar Sep 13 '21 20:09 pokowaka