As a member of the legal community, I have to speak. I know folks tend to speak tongue in cheek, and get a laugh, but some might get the idea to actually do things like this.
Whether or not the one that is on the receiving end of such primed devices is perpetrating a crime at the time, anyone involved in setting up a primed device like this is liable for possible criminal charges if it goes off and causes any real damages. Such devices do not discriminate when they go off, and frequently, unintended consequences and damage results. In addition to criminal penalties, civil penalties, where the level of proof and elements of claims are reduced, can add up to 6 figures and beyond quite easily.
Example: a potential thief steps up and grabs the booby trapped container, and it goes off. The thief is startled and jerks backward, losing his balance, falls off of the porch and hits his head on the sidewalk. He suffers severe brain damage, and is wheelchair bound for the next 35 years of his life. The jury awards the thief with the $260K of special damages (hospital, rehab, remodeling his house for the wheelchair, and a vehicle to accommodate the wheelchair). In addition, the jury awards $2.5M to compensate for his loss of income according to related actuarial tables, his inability to have marital relations with his wife, his inability to relate physically with his two children, his inability to maintain his home and vehicles on his own, court costs he incurred in bringing the law suit, etc., etc., etc.
For folks with access to legal research tools, informative cases will be found, relating to what are called "spring guns." Here is a good place to start:
https://h2o.law.harvard.edu/collages/2773
Think twice people,
Rich P