How did Snape know what memory Harry had seen? (open spoliers for HBP & ootp)

I was going to go into a long dissertation on the extent of Snape’s powers, and what that would mean, but I realized I could just sum it up as:
A wizard did it.

Sure, a zombie wizard, but it’s still an intriguing question…

From The Order of the Phoenix:

So in the book, Snape was witness to the memories in person. He also had enough time to read Harry’s mind during the part where he holds Harry’s arm tightly and then shakes him.