Cranksets usually have the names on them. Exact number may be on the inside of the crank arm.
Cassettes may carry a small sticker, also on the inside. May not be visible with the cassette on the bike. Some can be identified by their structure. How many sprockets that attach to a carrier, how many that extends all the way to the freehub body.
Functionally, counting the teeth and number of sprockets will tell you most things about a cassette.