The previous answers are correct in that geophysics and crust-mantle samples are the main tools for sorting out the composition of the core.
In addition, don't forget that meteorites are the solid 'left overs' of planetary formation, and we have many thousands of meteorite analyses. Most are 'rocky', but some are palasites (mixed rock-iron), or 'irons', whose composition is basically iron with a lessersmaller percentage of alloyed nickel and a few other heavy metals. Even allowing for the fact that average meteorite composition does not necessarily yield 'average Earth' composition, the presence of so much nickel-iron in meteorites is a strong pointer to the likely core composition of the Earth, and is entirely consistent with clues from geophysics.