The Israeli military has confirmed the attack , saying its helicopter targeted two men who were firing rockets across the border into Israeli territory .