A mere battery isn't going to do anything to someone touching the terminals. You need a voltage multiplier (aka a "tazer") wired across the grips to generate sufficient voltage to make things unpleasant for uninvited motorcycle molesters.
Things to think about: A tazer-level voltage applied across the hands will result in current flowing across the heart. This is one of the surest ways to cause cardiac arrest and/or fibrillation; if you wire your machine this way be sure you're willing to face manslaughter or murder charges.
As well, the grip-reflex that occurs when someone is being electrocuted through the hands might mean that the individual is still attached to your motorcycle when you return, depending on the capacity of the power source and the duration of the shock. Loss of muscle control will likely mean he's lying on top of (or under) your bike. Another thing to think about from a legal defense perspective.
We live in a society where molesters, criminals etc are coddled and protected and people trying to protect their stuff are prosecuted and persecuted. Something to keep in mind when planning booby traps for malcontents.