# Need to create a circuit for a Man in the Middle Attack [closed]

The title sounds worse than it really is :)

I have a printer which is connected to a host, the host uses proprietary hardware to send data to the printer. The issue is the host's date is limited to 2013 and I can't change it beyond that year without modifying the ROM on the host, which I don't think is practical.

The printer is a Transact Epic 950 and takes commands over RS232. You can find the OEM manual here

My workaround for this issue, was to create a circuit to sit between the Host and the Printer and basically change or replace the date before it hits the printer.

I have very little experience in electronics so wouldn't know where to start.

If anyone could point me in the right direction, that would be great.

• Is the host just transmitting plaintext ASCII or is it sending bitmap / TrueType? If it's ASCII it should be fairly easy. Jul 29 at 17:13
• I'm fairly sure its ASCII. The printer has fields into which the data is passed. There is the option of an image so maybe this is passed in hex. Jul 29 at 17:17
• Assuming it's text as Transistor points out, this can probably be done with an Arduino Mega or equivalent, which provides the hardware for two serial ports at 5V, and a couple of MAX3232 (or equivalent) chips to convert between 5V and the higher-voltage RS-232 signals, as well as a 5V supply (USB or somewhere else). You'd need some C/C++ knowledge to write a program for it that can intercept the printed message and swap the date; assuming the fields are easy enough to parse this shouldn't be too difficult. Jul 29 at 17:17
• Following up on my prior comment, if you can give some feedback about your level of familiarity with the things I mentioned so far, it will help determine whether a full answer is feasible and how detailed it should be to help make this a reality. Jul 29 at 17:20
• My electronics is very basic, resistors, diodes, transistors... basically school stuff. My expertise is software engineering, but I don't have much in C++. I'm higher level language guy. Jul 29 at 17:23

Buy two USB to RS232 adapters, connect those to a PC between devices to sniff the bus with a terminal program that supports sniffing.

Another option with two separate standard terminal programs is to connect transmit pins of both devices also to two receive pins on PC so PC can see while the devices communicate together.

• Thanks, I'll purchase the cables and connectors to check the output and work from there. Jul 29 at 18:32
• This won't work if the protocol has any sort of tight timings. Most USB to serial converters are polled every (iirc) 16ms, this might create issues. I do know that I've had problem with high-baud ModBus RTU. Edit: I thought you wanted the data to be edited on the PC. Aug 3 at 22:47
• @JanDorniak Sure, the pass-thru might not work if there is timing involved. That's why I suggested sniffing TX and RX separately too. And most does not mean all, and with good chipsets (and I only know of one good that I trust) and drivers the timeout is configurable, which can be set to minimum. Aug 3 at 22:50
• Maybe if you code it yourself using libftdi instead of relying on the OS it could be configurable and a passthrough would work. I mostly thought about actually changing the data, not just sniffing it. Also, I checked the converter I've got connected to my PC right now, turns out that FT232R has bulk endpoints with a vendor specific class. Bulk meaning that actual polling rate is... complicated to say the least. Aug 3 at 23:28

If the print data is ASCII it should be fairly easy.

Pseudo code for box in the middle.

while(1 == 1){
a = readLine();     #Buffer one line ending in CRLF.
b = replace("-2013", a, format(now(), "-YYYY"));
serial.print(b);
}


The "-2013" or "/2013" should weed out non-date occurrences of 2013.

First thing to do is use a terminal emulator program to monitor the host output and check that it is in fact ASCII and to figure out what the line break character sequence is. Something like PuTTY would be an excellent choice.

• Thanks, I'll purchase the cables and connectors to check the output and work from there. Jul 29 at 18:32