Rendering Smoke Effects Matte

Hi Guys, i would like to know if anyone knows how to render mattes of a smoke on a box. I intend to composite the layer with only smoke back onto the renders so i can render it seperately.

Similar along the lines of something like this: