
Android 및 iOS의 HTTP/HTTPS 트래픽을 Charles Proxy로 가로채는 단계별 가이드로, SSL 프록시, CA 인증서 설치, 신뢰 설정을 다룹니다.
모바일 해커를 위한 Charles Proxy 가이드 👍
Charles는 HTTP 프록시 / HTTP 모니터 / 리버스 프록시로, 개발자가 자신의 머신과 인터넷 사이의 모든 HTTP 및 SSL / HTTPS 트래픽을 볼 수 있게 해줍니다. 여기에는 요청, 응답 및 HTTP 헤더(쿠키와 캐싱 정보를 포함)가 포함됩니다.
Charles -> Proxy -> SSL Proxying Settings... -> SSL Proxying
Charles -> Help -> SSL Proxying -> Install Charles Root Certificate
Charles가 수신 대기 중인 IP 주소를 확인합니다
ifconfig | tr "\n" "→" | tr "\r" "→" | grep -Eo "→en0.*?→en[[:digit:]]" | grep -Eo "inet[[:blank:]+]([0-9]{1,3}\.){3}[0-9]{1,3}" | cut -d' ' -f2 | tr -d "\n" | pbcopy && pbpaste
ifconfig | tr "\n" "→" | tr "\r" "→" | grep -Eo "→en[[:digit:]].*?active→" | grep -v "en0" | grep -Eo "inet[[:blank:]+]([0-9]{1,3}\.){3}[0-9]{1,3}" | cut -d' ' -f2 | tr -d "\n" | pbcopy && pbpaste
Charles를 실행하고 계속 실행 상태로 둡니다
IP 주소를 확인합니다
Android 기기가 Charles와 동일한 네트워크를 사용하는지 확인합니다
Android 기기에서
Settings -> Wi-Fi -> 사용 중인 네트워크를 길게 클릭 -> Modify network -> Advanced options -> Proxy -> Manual로 이동합니다
브라우저를 실행하고 https://chls.pro/ssl 을 방문하여 인증서를 저장합니다
컴퓨터에 "A connection attempt to Charles has been made from the host ..."라는 대화 상자가 나타나면 Allow 버튼을 클릭합니다
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
application 아래에 networkSecurityConfig 속성만 추가하면 됩니다.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:networkSecurityConfig="@xml/network_security_config">
</application>
</manifest>
이제 앱의 디버그 빌드 변형에서는 SSL 프록싱이 작동하지만, 릴리스 빌드 변형에서는 작동하지 않습니다.
Charles를 실행하고 계속 실행 상태로 둡니다
IP 주소를 확인합니다
iOS 기기가 Charles와 동일한 네트워크를 사용하는지 확인합니다
iOS 기기에서
Settings -> Wi-Fi -> 사용 중인 네트워크 클릭 -> HTTP PROXY를 Manual로 설정
Safari를 실행하고 https://chls.pro/ssl 에 접속하여(작동하지 않으면 http://www.charlesproxy.com/getssl 시도) 인증서를 설치합니다
컴퓨터에 "A connection attempt to Charles has been made from the host ..."라는 대화 상자가 나타나면 Allow 버튼을 클릭합니다
터미널에서 curl을 통해 디버깅해야 하는 경우:
Charles를 프록시로 설정하려면
export http_proxy=http://127.0.0.1:8888 && export https_proxy=$http_proxy
프록시를 제거하려면
unset http_proxy https_proxy