There are no good guys. Hamas surely knew what their action would bring down. They figured out how to circumvent electronic security and used that knowledge to slaughter civilians. If you think it is ever OK to murder people including old people and children then I can't help you. Hamas had to know that thousands of Palestinians, who they nominally represent, would die as a result of their actions. Therefore they displayed an indifference to the lives of the Palestinians every bit as depraved as that of the government of the state of Israel.
On top of that it isn't as if there is any "democracy" to defend here. Hamas are religious fanatics. Netanyahu is basically Donald Trump but with brains.