iterate the shapes? how do you obtain the data with ls?
if so you can use ls -sl -dag -et mesh; (no nurbs particle or bone shapes need to list shapes are needed).
then just chek if it is connected to a smooth downstream (upstream the other is connected to smooth)
listConnections -s 1 -d 0 pCubeShape1; Altough this isnt foolproof as there might be other nodes in between too...
edity
better solution could be to attack this the other way around and list all smooths and the se if they end up in your shape?