Like you, I wasn't able to find an easy way to find this. Maybe it slipped past me and someone else could inform you. The only way I could figure how to it was quite messy and I'm not sure it works 100% of the time (especially with tooltip modifying addons), but from my limited testing it seems to work okay and it might give you a start.
Code:
/script faction = (GameTooltip:NumLines() > 2 and not UnitIsPlayer(select(2,GameTooltip:GetUnit()))) and getglobal("GameTooltipTextLeft"..GameTooltip:NumLines()-1):GetText() DEFAULT_CHAT_FRAME:AddMessage(faction or "NIL")
Edit: This reads straight from the GameTooltip, so it only works when you're mousing over a target. If you want unit to be "target", you'd probably have to set the GameTooltip to that unit then do this.