I keep looking at it and I have no idea what it does. Initially I thought it was the wiper motor but that's under the plastic shield. Just a weird black cylinder with a keyhole and some wires coming out of it, something to do with the anti-theft system maybe?

Ah ok that makes sense. Might as well remove it seeing that it doesn't make noise anymore and the anti-theft system is bypassed through a switch.