I want to create an application that works as a "man in the middle" to analyze a protocol (ISO 8583) sent over TCP/IP.
Some context: The main idea is to get the raw binary data and convert it to a string for parsing and decoding the protocol.
There are two parts to the project:
I am expending too much time on the first part. So, if there is a mock-up that I can use to get me started, it will be nice. It doesn't have to be with Indy, but I prefer C++Builder.
This is my first time with Indy, and although I have experience working with TCP/IP, I have always used it as something that is already there, never at the low-level implementation.
I am testing with Hercules, and so far I can see the connections.
When I connect to a server in Hercules, I can see that my application is connecting. But, when my application disconnects, I don't see a message that says so, which means (I think) that my app is not disconnecting correctly (but I can reconnect as many times as I want).
I am sending data to my application using Hercules (a "Hello" string). It is working apparently, but I am having a hard time getting the actual data.
The documentation sometimes gets me into dead links, there are no samples or they are available on Delphi.
I am working with the following:
Windows 11 Home
Embarcadero® C++Builder 10.4 Version 27.0.40680.4203
Delphi and C++ Builder 10.4 Update 2
Indy 10.6.2.0
Have a look at Indy's TIdMappedPortTCP
component. It is a TCP server that acts as a MITM proxy between clients and a specified server, giving you events when either party sends raw data.
Use the Bindings
collection, or DefaultPort
property, to specify the local IP/Port(s) that you want the server to listen for clients on.
Use the MappedHost
and MappedPort
properties to specify the remote server that you want TIdMappedPortTCP
to connect to.
The OnBeforeConnect
event is fired when a client has connected to TIdMappePortTCP
.
The OnConnect
event is fired just before TIdMappedPortTCP
attempts to connect to the remote server.
The OnOutboundClientConnect
event is fired when TIdMappedPortTCP
has connected to the remote server.
The OnExecute
event is fired when a client send bytes to TIdMappedPortTCP
, and before the bytes are sent to the remote server. The event can alter the bytes, if desired.
The OnOutboundData
event is fired when the remote server send bytes to TIdMappedPortTCP
, and before the bytes are sent to the client. The event can alter the bytes, if desired.