What is the purpose of squawking 7777?
In countries outside of the US, 7777 may be used by test transponders (RABMs) to check correctness of radar stations (BITE). e.g. on top of a mountain.

In the US, it seems that it is used as well on active air defense missions without ATC clearance. This would mean that the interceptor aircraft would change it's squawk to 7777 for the military/civilian air traffic controller to see it properly (if not filtered out on civil radars).

A link to the US intercept procedures is here.