Usually it's a sign of wanting/expecting food and/or it could be defensive.
Mine do that often but I also don't handle them a ton, so when I am in the room, they know they are usually either getting fed or cleaned and they always are hoping for the feed. lol I will note, some do it, some never do, so it does vary.
Also just because they act hungry doesn't mean they need to feed. They are opportunistic and will easily over-eat.
The best thing I can say is to either move the cage so the cat isn't walking by it and see if that helps or try covering half the cage with a sheet or some opaque kraft paper. The snake may sit on the 'dark' side and stop striking the front.
Hope that helps!