A simple HTTP/HTTPS proxy server used to capture traffic to a USB connected IHC controller. It is useful to investigate how existing applications use the undocumented IHC controller API's. Mostly of use for internal SDK development.
Nb. This recorder works with Windows PC only because it assumes the interface 'http://usb' which in turn requires a Windows USB HTTP driver that Schneider Electric has released only for Windows.
To use:
- Connect the IHC controller to a USB port on the Windows PC that runs this proxy.
- Configure the IHC software that you want to capture trafic to/from to http://localhost:5083
- Run this proxy
- .NET 9.0 SDK
- Clone the repository
- Navigate to the project directory
- Restore dependencies:
dotnet restore
- Trust the development certificate for HTTPS !!
dotnet dev-certs https --trust
Run the proxy server with default settings:
dotnet runThe proxy will start on:
- HTTP:
http://localhost:5082 - HTTPS:
https://localhost:5083(with SSL termination)
Both endpoints forward all requests to http://usb.
All captured traffic is automatically logged to a capture.log file with timestamps. Use Ctrl+C to stop the proxy, which will ensure the log file is properly closed and flushed.
To include HTTP headers in the console output, you can either:
-
Set the environment variable:
LOG_HEADERS=true dotnet run
-
Or modify
appsettings.json:{ "LogHeaders": true }
The proxy logs all traffic to both console and capture.log file with:
- Correlation ID: Sequential integer for matching requests with responses
- Request details: HTTP method, URL, and body
- Response details: Status code, reason phrase, and body
- Headers: Optionally displayed when header logging is enabled
- Timestamps: Added to log file entries for precise timing
Example output:
HTTP/HTTPS Proxy Server starting...
Proxy endpoints:
HTTP: http://localhost:5082
HTTPS: https://localhost:5083 (SSL termination)
Forwarding all traffic to: http://usb
Header logging: DISABLED (set LOG_HEADERS=true to enable)
Logging to file: capture.log
----------------------------------------
Ready to receive requests...
[1] ====== REQUEST ======
[1] POST http://usb/api/data
[1] Body: {"test": "data"}
[1] ====== RESPONSE ======
[1] Status: 200 OK
[1] Body: {"result": "success"}
- Ports:
- HTTP: 5082
- HTTPS: 5083 (with SSL termination)
- Target: http://usb (all requests are forwarded here)
- Environment: Development mode by default
- SSL Certificate: Uses ASP.NET Core development certificate
To build the project:
dotnet buildTo clean build artifacts:
dotnet clean