Instead, stop moving and reacting to the cat. This will take away all the fun the cat gets from the attack.
[header] How to handle a cat that suddenly attacks you [title] Act calmly. [step] Reacting strongly can increase the cat's stress and interest in attacking you. It may even make the cat's prey instinct kick in more, spurring it on to bite down harder.