The way Hamas is playing this is they seem to think they can "win". What their demands are, and what a strategic win looks like for them remains unclear, at least from what I'm able to glean from open-source information.
Terrorist organizations are also often populated with people who have a.) very little to lose, and 2.) enjoy the thought of fighting, or "revenge", or whatever- similar to some "doomsday preppers" who appear to relish the idea of shooting their neighbors without consequences.
So there's likely a strong emotional component that might minimize how much they thought this through. Someone (Iran) hands you the resources for a surprise attack against your most hated enemy, you might do it without considering all the implications.
I hope Israel wipes the floor with them.