How long does it take to ripen tomatoes in a bag with bananas?
I usually harvest my unripe tomatoes the night before the first hard frost. Anything beyond hard green, and into the yellowish/red stage, goes in a cardboard box with a ripening apple.
That yields me a steady supply of ripe and fairly tasty tomatoes through Thanksgiving, and some years up until Christmas.

Cover the box with a towel. Some of the tomatoes will go bad, turning soft and squishy, so you need to sort every week or so, and consider drainage in your storage spot, but the majority will eventually ripen.
Bananas are ferocious sources of the ripening agent, ethylene, so the time frame with them might be somewhat shorter. Temperature also changes the rate of ripening. Cooler is slower; a fridge is too cold.

Ethylene is heavier than air, so a closed container with a lid is all that's needed to keep it in.