How do you take a picture of a cobra? With great care, and always with two or three experienced people present. Do not "try this at home"!
We use telephoto lenses, so whilst the cobra looks close, it is in fact well out of striking distance. Plus, one person is always "in charge" of looking after the cobra - with specialised snake sticks and tongs, and a good knowledge of their behaviour - whilst the other person photographs the snake, but they too remain alert.
Here my friend Adam from www.hongkongsnakeid.com takes pictures of a small and hooded cobra.
Using a wider angle lens, like below, allows you to take in more of the surroundings, and give a more "in situ" feel to the photograph.