That does not look like a cobra. A common rat snake would seem more likely which would have been good to leave alone. Should have left it alone as it would have killed and ate mice, rats and small animals. If it isnt attacking you, and snakes don't unless they feel threatened, let them be they are good animals to have around.