Hamas as a group only exists because of decades of oppression by the Zionist regime. Eradication of Hamas will not lead to eradication of attacks on Israel because the people of Palestine want revolution and cannot let the status quo continue: it's just a question of when and how.
You can't kill this hydra without ending the life of every Palestinian in Gaza.
In general, revolutionary groups are formed as a product of circumstance: the American Revolution by British oppression, the French Revolution by Bourbon oppression, the Russian Revolution by Tsarist oppression, and the Chinese Revolution by Ming oppression. You can't have revolution without oppression and oppression will, by nature, lead to revolution.