The catapult is a war machine that is used to demolish walls behind which the enemies fortify themselves. The Prophet (peace be upon him) used it to throw stones at those walls, but he most certainly did not employ snakes or fire.
The intended targets were the fortifications and the enemy combatants who were fighting from their stations upon the fortifications and from directly behind them. In fact, during the battle, the soldiers and archers of al-Tâ’if from their vantage point upon the fortifications, had succeeded in killing or injuring a great number of the Prophet’s Companions. The graves of some of those Companions can be seen in al-Tâ’if up to today.
Ultimately, the Prophet (peace be upon him) gave up the siege and left the city alone. Its inhabitants later accepted Islam.
The targets intended by the catapults were clearly not civilians, women, or children, though there was a remote possibility under those circumstances that some civilians could have been injured unintentionally. This, however, is quite different than intentionally attacking civilian targets, women, and children. Any direct attack against such people is categorically unlawful and had been expressly prohibited by the Prophet (peace be upon him).
Source: Islam Today