If it's runny, wipe the bulk of it with a tissue. Will be easier to wash later.
If it's solid, it won't leave so much of a mess, but you will have to handle it with your hand. Can use said tissue to handle it.
If it's solid accompanied with liquid, may the Flying Spaghetti Monster have mercy on your soul.
As for the hole, instead of worrying about your boxers and trousers, I'd focus my worry on your shitting hole. You may have damaged it, and run the risk of a prolapse.