Mitmproxy
HTTP 1/2, 웹소켓, SSL/TLS 등의 웹 트래픽을 인터셉트, 수정, 리플레이 하기 위한 오픈소스 HTTPS Proxy
Features
- CLI + Web UI + Python API 제공 및 강력한 에코 시스템
- 7.0 추가 기능
- Full TCP 지원 (SMTP 같은 프로토콜)
- HTTP/1 과 HTTP/2 상호 연동 : HTTP/2 클라이언트를 HTTP/1 서버로 연결
- UI에서 WebSocket 메시지 표시 지원
- Secure Web Proxy (TLS-over-TLS)
- 윈도우OS에서도 Console UI 지원
- Web UI 개선 : TCP / WebSocket 플로우 렌더링, cURL/HTTPie/Raw HTTP Export 지원
- Async Event Hook 지원
- 새로운 TLS Event Hook 지원 (TLS Handshake 성공/실패)
- SOCKS v5 인증 지원
Usage
포트를 바꾸고 싶다면:
Docker Usage
To launch the terminal user interface of mitmproxy:
NOTE |
볼륨 마운트를 위한 |
Once started, mitmproxy listens as an HTTP proxy on localhost:8080
:
$ http_proxy=http://localhost:8080/ curl http://example.com/
$ https_proxy=http://localhost:8080/ curl -k https://example.com/ # `-k` 옵션 주목
INFORMATION |
참고로 curl 에서 사용할 때 소문자를 사용한다. |
You can also start mitmdump by just adding that to the end of the command-line:
For mitmweb, you also need to expose port 8081:
$ docker run --rm -it -p 8080:8080 -p 127.0.0.1:8081:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0
You can also pass options directly via the CLI:
If ~/.mitmproxy/mitmproxy-ca.pem
is present in the container, mitmproxy will assume uid and gid from the file owner. For further details, please consult the mitmproxy documentation.
Docker 로 사용할 경우 유의 사항
Proxy 를 경유하면 결국, Docker 에서 요청할 서버에 재 요청 들어가는데, URL 을 localhost 같은 걸로 하면 Guest OS 에서 localhost loopback 요청하게 된다. 따라서 Host PC의 IP를 직접 쳐야 한다.
리버스 터널링으로 연결하기
OpenSSH#리버스 터널링으로 연결하기 항목 참조.
See also
- Proxy
- Proxy Server
- httpie
- tcpdump
- MitmProxy2Swagger - REST API 자동 리버스 엔지니어링 도구