My speculation is what Hamas was thinking when they launched their terrorist attack on Israel on 7 Oct was that Israel would respond pretty much as it has, which would do two things:
1. Wake the world up so they would pay attention to how Israel was continuing to occupy Palestinian land, and;
2. Provoke Israel into a counterattack, which would, as they've done in the past, be completely over-the-top and weaken their support from their allies, bringing more of the world onto the side of the Palestinians.
And, if that was their thinking...it's working!