Re: Is this kind of thing legal?
Not a "booby trap",unless it causes physical injury,maims,kills,etc..
This is a psyhcological deterrent.
It ain't cheap,but,think of the money you will save on fertilizer.
Of course,you can get the same bang for cheap with those "party popper" fireworks.
The best ones are a paper tube with a string on each end.
They can also be "enhanced" for better performance.
I once scared a thief so bad ,there wasn't a reported burglary for over a year!
Our neighborhood was having a rash of burglaries.
He rarely entered the living quarters,just stuck to sheds,garages,basements,etc..
Mostly took power tools,easily pawned/fenced.
I had a basement / crawlspace,with a door that opened outward,and,no opening to the upstairs living area.
I got a couple of broken chainsaws and a weedeater from a yardsale,and,left them sitting on my front porch for a day,then put them in the basement.
I filled a 30 gallon trash can aprox. 1/3 full of water,poured in 2 gallons of vinegar( he's a doushebag anyway...).
From the same yardsale,I obtained a pile of empty battery acid containers,of all sorts,for free.
Next,a trip to the grocery store for the big box of denture cleaner tablets,and,a bottle of yellow foodcoloring.
I added the foodcoloring to the spiked water,and,set it so it was leaning against the door,and,would tip outward when the door was opened.
The battery acid containers were left piled outside,by the door.
I raked back a layer of peagravel from in front of the door,and,layed a thick layer of broken denture tablets down,covering them with a thin layer of peagravel.
As an afterthought,I loaded the gardenhose next to the door, with several ounces of rhodamine dye(brilliant blood-red color,used for tracing ground water,enhancing fountains,whatever..).
Next morning,The trap was still set,so went to work with spirits high.
Upon returning home that afternoon,I found several of the cities finest,including TWO detectives,investigating a "reported disturbance"!
I was laughing so freaking hard I nearly peed myself,and,it took half an hour before I could get more than 3 words out at a time.
Seems one of my neighbors heard loud screaming and cursing,looked outside and saw a half naked man,covered in what looked like blood,running down the street like the hounds of hell were after him.

The cops didn't catch the guy,apearantly the "blood trail" ended where the getaway car was parked,so,they follwed the trail back to my house.
Here,they found an opened basement door,the acid container props,an empty trashcan with yellow residue,and,a boiling area of pea gravel.
The garden hose was running,and,the immediate area looked like a bloodbath.
2 shoes and a pair of jeans were also to be found,along with a prybar,but,no wallet.
In between gasps for air,I managed to convince the authourities that all the substances were harmless,and,that they could call off the haz-mat folks.
They were not sure whether to arrest me for malicious mischief,disturbing the peace,OR,creating a public panic.
All except for the 2 detectives ,who,by this time,were laughing so hard they couldn't take my statement.
Of course the neighbors wanted me to get a medal,BUT, thier kids avoided my house on Halloween,from that time forward.

If this happened post-9/11,however,I would probably be in prison for life,still laughing like a the evil bastage I am!