I love animals. They're precious. They should never be hurt. They should be protected from people.
But right here, attacking the dog is justified. As much it would break my heart, I wouldn't blame the man with the cap. I'd defend him for his actions. But my heart weeps for the dog. The poor training and lack of caring owner is to blame here.
You'd be justified to punch both. I'd hope to disarm the dog, i.e. push in their cheeks to force the mouth to open. But since it's a stranger's dog. And with it's tendency to attack people it would be very unpredictable and I probably wouldn't have the courage to try were I in this situation. While you're under attack, you'd be very justified to go for the dog.
This person shouldn't ever own animals. Ever. And they should be in jail for assault. This whole situation disgusts me. It is wrong in so many ways. And the dude is laughing? I'm (figuratively) crying for the man and the dog. The dog is going to meet someone who wont just take this and get injured, or killed. When that happens, I hope the owner faces any kind of judgement.