A dedicated model for this purpose could easily run locally. Recognizing shapes is not exactly cutting age AI.
The input to the detector could be not the G code instructions, but a 3D model representation recovered by simulating the G code. (That's a thing that exists.)
The requirements for a 3D printer which detects weapon shapes is actually fairly realistic.
It would likely have laughable false positives: 8-year-old Johnny not being able to 3D print a squirt pistol.
Some common tools have pistol-like form factors: spray guns, glue/grease/caulking guns, drills, hair dryers.
It is a cockamamie idea; but to claim that it is not doable seems a bit disingenuous.