>>2727562Nta, I think the dog's ability to detect things in humans comes from two places 1. Instinctual tendencies developed by long periods of time operating as social animals with other canines and 2. A modest period of being genetically modified as human companion animals. I think No. 1 is most of it though- the human modification was really more to pick out the animals that had tendencies that did not clash with human cohabitation.
Anyways, what you'd be looking for is an animal that is able to detect cues on whether a person is "in" or "out" from a pack perspective, and I think they are pretty decent with detecting aggressive human postures etc.
Most of the time we say a dog is able to "know" if a person is "bad," I think it has more to do with the dog picking up on cues toeard that person from the humans in it's group. While not being "evil detectors" it's still a fairly complex and impressive trait for an animal to have though.
Having said that I have seen some fairly uncanny responses from dogs to certain types of people over the years.