Iran made many mistakes, but if you remember last few invasions of Lebanon, Israel was easily able to capture Beirut in couple of days everytime, and they used to decimate Beirut every time, but this time they could only go few kilometers beyond the border in months.
And there was still some deterrence from hezbollah hence Israel wasn't able to hit the civilian infrastructure like airports etc otherwise hezbollah could hit back Tel-aviv aiport too, this was all possible after with the help of Iran.
Of course Israel killed thousands of civilians which hezbollah and Iran couldn't reciprocate because of their principal of not harming civilians.