Printed circuit board connector identification
CAN bus needs only 3 wires 2 signals and a ground so a 4 wire terminal with an added power terminal seems plausible. the two transistors and two large 120-ohm resistors are also consistent with a CAN driver
The second one probably is RS485, you can see that the traces for + and - are wide and come from elsewhere on the board, so they are probably power terminals.
Check the part number on the SO8 that's behind the terminals, Im expecting that that's an RS485 driver.
As for how to be sure: figure out what parts on the board are connected to which the terminals on the connector.