Draupadi slept with Karna

Is vengeance and punishment allowed in Hinduism?

If so, can someone take revenge and punish someone who did wrong? Should someone be blamed for punishing the corrupt group of people in society?

Taking revenge and punishing someone are not exactly the same thing. Wrong perpetrators should always be punished. Failing to punish them is again a culpable act.

Here are some verses from the Manu Smriti that speak about the need for punishment.

Manu Smriti 7.22. The whole world is kept in order through punishment because a guiltless man is hard to find; for fear of punishment, the whole world produces the pleasures (which it owes)

Manu Smriti 7.23. The gods, the danavas, the gandharvas, the rakshasas, the bird and snake deities even give the pleasures (owed by them) only when they are tormented by (the fear of) punishment.

Manu Smriti 7.14. For the king's sake, the Lord earlier created his own son Punishment, the protector of all creatures (an incarnation of the law), formed from Brahman's glory.

And it is the king's duty to carry out punishments. A king who does not punish the wicked sinks into the lower worlds.

Manu Smriti 7.16. Having fully taken into account the time and place (of the offense), strength and knowledge (of the perpetrator), he rightly allows this to be imposed on men (who act wrongly).

7.18. Punishment alone rules all created beings, punishment alone protects them, punishment watches over them while they sleep; The wise explain punishment (to be identical with the law).

7.19. When (punishment) is properly applied after (due) reflection, it makes all people happy; but done without consideration, it destroys everything.

7.20. If the king did not punish those worthy of punishment without weariness, the stronger would fry the weaker like fish on a spit;

Revenge, on the other hand, is not considered a good attribute.

When external or spiritual pain is generated by others and one is not offended and does not seek vengeance, it (ie, the mind) is called Dama. (39)

Atri Smriti, chapter 1, verse 39.

And Dama, Dana (charity), Aspriha (lack of desire), Daya (mercy), Soucha (cleanliness), etc., are considered auspicious qualities or mangala for all households. So a vengeful temperament is not praised at all in Scripture.

Rishi

This is a great answer