들어오는 모든 http 요청을 어떻게 모니터링합니까?
내가 들어오는 HTTP에서 내 응용 프로그램을 모니터링해야 POST
하고 GET
요청은 외부에서 때로는 기계 내부에 발생.
이것이 가능한가?
피들러를 사용하고 있지만 이것은 (시스템 외부에서) 수신되지 않는 발신 만 수행하거나 잘못 구성 했습니까?
이것은 POST
외부 서버에서 수신하는 내 웹 앱용입니다 .
해야 할 일은 Fiddler가 "역방향 프록시"로 작동하도록 구성 하는 것입니다.
Fiddler 웹 사이트에서이를 수행 할 수있는 두 가지 방법에 대한 지침이 있습니다. 다음은 단계의 사본입니다.
0 단계
다음 옵션 중 하나가 작동하기 전에 다른 컴퓨터가 Fiddler에 연결되도록 설정해야합니다. 이렇게하려면 도구> Fiddler 옵션> 연결을 클릭하고 "원격 컴퓨터의 연결 허용"확인란을 선택합니다. 그런 다음 Fiddler를 닫습니다.
옵션 # 1 : Fiddler를 리버스 프록시로 구성
Fiddler는 전송되는 모든 트래픽 http://127.0.0.1:8888
이 동일한 시스템의 다른 포트로 자동으로 전송 되도록 구성 할 수 있습니다 . 이 구성을 설정하려면 :
- REGEDIT 시작
- HKCU \ SOFTWARE \ Microsoft \ Fiddler2 내에 ReverseProxyForPort라는 새 DWORD를 만듭니다.
- 인바운드 트래픽을 다시 라우팅 할 로컬 포트로 DWORD를 설정합니다 (일반적으로 표준 HTTP 서버의 경우 포트 80).
- Fiddler 다시 시작
- 브라우저를 다음으로 이동하십시오.
http://127.0.0.1:8888
옵션 # 2 : FiddlerScript 규칙 작성
또는 동일한 작업을 수행하는 규칙을 작성할 수 있습니다.
WEBSERVER라는 컴퓨터의 포트 80에서 웹 사이트를 실행하고 있다고 가정 해 보겠습니다. 웹 프록시를 구성 할 수없는 Windows SmartPhone 장치에서 Internet Explorer Mobile Edition을 사용하여 웹 사이트에 연결하고 있습니다. 전화기의 트래픽과 서버의 응답을 캡처하려고합니다.
- 기본 포트 8888에서 실행되는 WEBSERVER 시스템에서 Fiddler를 시작하십시오.
- 도구 | Fiddler 옵션을 클릭하고 "원격 클라이언트의 연결 허용"확인란이 선택되어 있는지 확인합니다. 필요한 경우 다시 시작하십시오.
- 규칙 선택 | 규칙을 사용자 지정합니다.
- OnBeforeRequest 처리기 안에 새 코드 줄을 추가합니다.
if (oSession.host.toLowerCase () == "webserver : 8888") oSession.host = "webserver : 80"; - 스마트 폰에서 다음으로 이동합니다.
http://webserver:8888
스마트 폰의 요청이 Fiddler에 표시됩니다. 요청은 포트 8888에서 웹 서버가 실행중인 포트 80으로 전달됩니다. 응답은 Fiddler를 통해 SmartPhone으로 다시 전송되며 콘텐츠가 원래 포트 80에서 온 것인지 전혀 알 수 없습니다.
Microsoft 네트워크 모니터를 설치하고 HTTP 패킷 (포트 필터링) 만보고 패킷 캡처를 시작하도록 도구를 구성합니다.
Windows에서 Fiddler를 '역방향 프록시'로 구성
(Mac의 경우 아래 Partizano의 의견에있는 링크 참조)
나는 이것을 제안하는 대답이 이미 있다는 것을 알고 있지만 Telerik 이 제공 해야 했던 이에 대한 설명과 지침을 제공하고 'gotchas'의 일부를 다루고 싶습니다 .
Fiddler를 '역방향 프록시'로 구성한다는 것은 무엇을 의미합니까?
- 기본적으로 Fiddler 는 Fiddler를 실행중인 컴퓨터에서 나가는 요청 만 모니터링 합니다.
- 들어오는 요청 을 모니터링하려면 '역방향 프록시'로 작동하도록 Fiddler를 구성해야합니다.
- 이것이 의미하는 바는 Fiddler를 수신 요청을 수신하려는 시스템의 특정 포트 (8888)로 전송되는 수신 http 요청을 가로 챌 '프록시'로 설정해야한다는 것입니다. 그런 다음 Fiddler는 이러한 요청을 http 요청을위한 일반적인 포트 (일반적으로 https의 경우 포트 80 또는 443)로 전송하여 동일한 컴퓨터의 웹 서버로 전달합니다. 실제로 매우 빠르고 쉽습니다!
- Fiddler를 사용하여이를 설정하는 표준 방법은 Fiddler가 포트 '8888'로 전송 된 모든 요청을 가로 채도록하는 것입니다 (일반적으로 다른 포트를 사용할 수는 있지만 일반적으로 다른 포트에서 사용되지 않기 때문입니다).
- 그런 다음 레지스트리 편집기를 사용하여 Fiddler가 포트 8888에서 수신하는 모든 http 요청을 전달하도록 Fiddler가 표준 http 포트 (https 요청의 경우 포트 80, 포트 443 또는 다른 사용자 지정 포트로 전달되도록해야합니다. 웹 서버가 수신하도록 설정 됨)
참고 :이 작업을 수행하려면 가로 채려는 모든 요청 을 포트 8888로 보내야합니다.
호스트 이름에 : 8888을 추가하면됩니다. 예를 들어 MVC 경로의 경우 다음과 같습니다.
http : // myhostname : 8888 / 컨트롤러 / 액션
연습
Fiddler가 포트 8888에서 원격 http 요청을 수락 할 수 있는지 확인합니다.
관리자 권한으로 Fiddler 실행 도구> Fiddler 옵션> 연결로 이동하여 '원격 컴퓨터 연결 허용'이 선택되어 있고 'Fiddler가 포트에서 수신 대기'가 8888로 설정되어 있는지 확인합니다.
포트 8888에서 수신 된 요청을 포트 80으로 전달하도록 Fiddler 구성
- Fiddler 닫기
- REGEDIT 시작
- HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ Fiddler2 내에 ReverseProxyForPort라는 새 DWORD를 만듭니다.
- 이제 인바운드 트래픽을 다시 라우팅 할 로컬 포트로 DWORD 값을 설정합니다 (일반적으로 표준 HTTP 서버의 경우 포트 80).
- 이렇게하려면 생성 한 DWORD를 마우스 오른쪽 버튼으로 클릭하고 '수정'을 선택합니다. 'Base'가 'Decimal'로 설정되어 있는지 확인하고 '값 데이터'로 '80'(또는 다른 포트)을 입력합니다.
방화벽에서 포트 8888이 열려 있는지 확인하십시오.
- You must ensure that port 8888 is open to external requests (it won't be by default if your server is firewall-protected)
That's it! Fiddler should now be set up as a reverse proxy, to intercept all requests from port 8888 (so that you can view them in Fiddler), and it will then forward them to your web server to actually be handled.
Test a request
- Restart Fiddler
- To test that Fiddler is intercepting external requests, open a browser on the same machine where you've set up Fiddler as a reverse proxy. Navigate your browser to http://127.0.0.1:8888
- This tests making a basic request to to port 8888
- You should see the request intercepted by Fiddler
- Now you can test a request from another machine, for example by making a request from a browser on another machine like this (where 'remoteHostname' is a hostname on the machine where you've set up Fiddler as a reverse proxy) :
http://remoteHostname:8888/controller/action
- Alternatively, you can compose a request by using another instance of Fiddler on a remote machine, using a URL similar to the one above. This will allow you to make either a GET or a POST request.
IMPORTANT: Once you've finished viewing your request(s), go back to Tools > Fiddler Options > Connections and remove the 'Allow remote computers to connect' option, otherwise 3rd parties will be able to bounce traffic through your server
Guys found the perfect way to monitor ALL traffic that is flowing locally between requests from my machine to my machine:
- Install Wireshark
When you need to capture traffic that is flowing from a localhost to a localhost then you will struggle to use wireshark as this only monitors incoming traffic on the network card. The way to do this is to add a route to windows that will force all traffic through a gateway and this be captured on the network interface.
To do this, add a route with
<ip address>
<gateway>
:cmd> route add 192.168.20.30 192.168.20.1
Then run a capture on wireshark (make sure you select the interface that has bytes flowing through it) Then filter.
The newly added routes will come up in black. (as they are local addresses)
Microsoft Message Analyzer is the successor of the Microsoft Network Monitor 3.4
If your http incoming traffic is going to your web server at 58000 port, start the Analyzer in Administrator mode and click new session:
use filter: tcp.Port = 58000 and HTTP
trace scenario: "Local Network Interfaces (Win 8 and earlier)" or "Local Network Interfaces (Win 8.1 and later)" depends on your OS
Parsing Level: Full
You might consider running Fiddler as a reverse proxy, you should be able to get clients to connect to Fiddler's address and then forward the requests from Fiddler to your application.
This will require either a bit of port manipulation or client config, depending on what's easier based on your requirements.
Details of how to do it are here: http://www.fiddler2.com/Fiddler/Help/ReverseProxy.asp
Use TcpView to see ports listening and connections. This will not give you the requests though.
In order to see requests, you need reverse of a proxy which I do not know of any such tools.
Use tracing to give you parts of the requests (first 1KB of the request).
Using Wireshark..
I have not tried this: http://wiki.wireshark.org/CaptureSetup/Loopback
If that works, you could then filter for http
/http contains GET
/http contains POST
traffic.
You might have to run two Wireshark instances, one capturing local, and one capturing remote. I'm not sure.
You can also try the HTTP Debugger, it has the built-in ability to display incoming HTTP requests and does not require any changes to the system configuration.
참고 URL : https://stackoverflow.com/questions/4428680/how-do-i-monitor-all-incoming-http-requests
'Development Tip' 카테고리의 다른 글
Java 클래스 용 인터페이스가 선호되는 이유는 무엇입니까? (0) | 2020.10.29 |
---|---|
BackgroundWorker의 처리되지 않은 예외 (0) | 2020.10.29 |
Objective-C에서 nil 테스트 — if (x! = nil) 대 if (x) (0) | 2020.10.29 |
Angular JS의 행에 대체 클래스를 할당하는 방법은 무엇입니까? (0) | 2020.10.29 |
Gulp로 여러 파일을 복사하고 폴더 구조를 유지하는 방법 (0) | 2020.10.29 |