There are a couple of ways to go. That little rectangular box is a cleanout plug. It’s brass. If you can unscrew it great – if not cut off the square with a Sawzall and you will find that it’s hollow. Then cut from the center out to the threads in pie sections. Peel the plug out of the female threads. If you’re lucky it will be 3″. Screw in a 3″ male adapter and kick on out… However it may be 3 1/2″ which is no longer made. Use a 5″ by 3″ Fernco bell with the 5″ over the hub of the cleanout. Bush down with a 3″; by 2″bush in the 3″ end of the Fernco and you’re home again.
The other way is to take a section out of the cast pipe, use Fernco’s around a PVC or ABS Sanitary Tee (whatever your state uses). That 6″ iron pipe is most likely 4″ cast. You can cut it with a Sawzall or snap it with a ratchet cutter that is made to cut cast iron. I bought one for $340 – so you might want to rent or beg/borrow one. BE SURE that if you take a section out of the cast, that the upper section of the pipe is supported so whole thing does not come crashing down.