In Japan, ninjas were mercenaries. They were also top-notch experts on gaining entry into fortified fiefdoms. Not just as spies, but at getting passwords for entry, mapping, and measuring food supplies. The last mention of them historically is during the Tokugawa Era, which represented a united Japan.