If you want to walk through all bodies in a space, you can use
cpSpaceEachBody.
If you want to find bodies that are near an area or that intersect a line segment, use one of the
Query functions.
That will give you access to the shapes, and from the shapes you can get access to their body using
cpShapeGetBody.