I don't think a scanner is the way to go. I can't realistically envision a way in which it can't be abused to relentlessly bust down undercover RP some player has probably spent a good while developing. If all of that RP goes down the drain just because some guy you never met has a "spy detector", then it defeats the entire purpose of even attempting to RP with anyone else other than a small group of people you know won't resort to petty tactics.
A good player who does undercover RP will cover their tracks and be careful. That should be rewarded with continued incognito status. A player who gets sloppy and starts handing out obvious hints about their allegiances should pay the price for it - they get exposed for what or who they are. An ingame item that throws interaction out the window is definitely not a good idea.