How powerful is Iran’s military? Can it take on the US if it attacks?

Amid the US threat of military action, Iran has said that ‘all American military centres, bases and ships in the region will be our legitimate targets’. But does Tehran have the firepower to carry out such an attack?