A former NASA engineer and YouTuber has come up with a novel way to get revenge on delivery parcel thieves.

Mark Rober, 38, recently built a trick parcel to get his own back on the so-called ‘porch pirates’ who had been taking packages from his doorstep.

Rober, who for seven years was part of the NASA team that built Mars’ Curiosity rover, decided to create a fake package containing glitter and fart spray.

The package was designed by Rober to trigger a glitter and noxious fart spray explosion once opened.

Rober also equipped his ‘bait parcel’ with multiple cameras and tracking software, so he could recover the footage later.

Rober on Tuesday uploaded a video of his exploits to YouTube, where it quickly racked up millions of views.

The video sees Rober designing, building and testing the device, before leaving it on his doorstep to tempt any would-be thieves.

Sure enough, a number of people passing by Rober’s house find his mysterious package too enticing not to take.

We then see a few different ‘victims’ take the device home with them, where they’re promptly showered with glitter and soaked in foul-smelling scents.

Rober says there’s one simple moral of his story: “Just don’t take other people’s stuff.”