Hi and welcome to the forum.
An 8mm wrench (spanner) would be for an M5 thread, as in 5mm diameter.
A 17mm wrench would be for an M10 thread, as in 10mm.
To my knowledge there are no set "standards" for cable end fittings etc. The sizes would probably be defined by the diameter of the actual inner cable and the loads it is expected to control.
An after market cable should do fine providing the cable materials are the same or similar. Inner cables can be steel, stainless steel or synthetic materials such as Nylon. The inner can be many smaller strands twisted together like electrical wire, or it can be a single solid strand, sometimes covered in a Nylon, Teflon or Polypropylene sheath.
If the bulkhead connection is welded or permanently attached to the bulkhead then you will need to match the thread pitch of the original M10. There is a range of pitches possible for the threads of both ends.
The same thread provision applies to the M5 end.
However, if both ends are held in place by nuts either side of a fixed plate with a simple through-hole then just use nuts to suit the threads that come with the after market cable ends.