Hamas militants hacked dozens of smartphones by posing as female admirers, Israel’s military says.