The fact is those dogs do exist, often in the form of the German Shepherd dog, but you will not be able to successfully train this dog yourself. It takes a very particular dog to be able to do that. You do not purchase a puppy, do some training classes, and magically have the dog you want.
Realistically, you would have to purchase the dog already trained like that. I know many celebrities, millionaires, etc that own dogs like these. It will cost you. Average price is $20,000-30,000.
What it takes? Specially hand picking puppies. Normally they will breed themselves or look to other countries, like Czech or Germany, for these dogs. Dogs with this true potential is 'rare', especially in the U.S. Then from just 7 weeks old they begin socialization and training. It generally takes 2-3 years for this dog to become what they are. Then once you have paid, they bring the dog to you and spend the night in a hotel so they can spend 1-2 days showing you care, commands, and how they've been trained. Importation, 3 years of care, 3 years of extensive daily training, air fees, hotel, etc.. That's why these dogs cost so much.
These dogs will know who is good and bad easily because those with bad intentions act different, have increased heart rates, etc.. They can tell. They will tell long before you know. Wouldn't hurt a fly but will take down someone threatening in a second.
A dog that is great with kids, accepts strangers, is friendly, and is an amazing guard dog is not one you will train yourself... you will just end up with an aggressive, misbehaved, dangerous dog.