Answer by Raakhee Venugopal:
Spies were always there. Going by the question, ‘during’ the war, the Kaurava prince Yuyutsu was a prime spy. Yuyutsu was a half brother of the Kauravas. He did not side his brothers and offered to fight on the Pandava side in the war. But he was asked to remain in the Kaurava camp and act as their spy. Yuyutsu was later crowned King of Hastinapura after the war was over.