They had to have infiltrated Iranian intelligence - and probably other members of Iran's political apparatus that keep everything "under control" like the Revolutionary Guard.
Iran's cultivated a society where there's a lot of benefit to being "a traitor" to their government. They're incredibly repressive and continually mismanage the economy (granted, sanctions don't help - but they're not going to get sanctions removed while maintaining a hard line) while government elites somehow manage to keep getting richer and richer.
But there's no way they conducted that really sophisticated assassination of the recent head of nuclear science for Iran without having people on the inside working for them. And I wouldn't be surprised if the reason they've got access to computer systems of critical infrastructure is due to similar infiltration.
But also, what can Iran really do in response? Israel's basically given a free pass at whatever they want to do on the international stage due to the US intervening, whereas if Iran responds they'll get bombed back into the stoneage by Israel and the US.
With hardliners coming back into power soon, I think the government isn't showing their hand... but it's easy to see how they're going to play their cards. They've got no interest in rejoining the JCPOA or any new deal with America - any deal will only be as good as Biden's administration is in power... which might not even be 2 full terms. And the US and Israel will act with inpunity for as long as Iran isn't nuclear.
So unfortunately, I think the regime is going to be on a fast track to building up a nuclear weapon... as well as generally modernising it's military. And once they've got a nuclear weapon, I think all hope of reform in Iran is pretty much dead - the status quo will be maintained because turbulent politics and upheaval will be too much to worry about for the world powers to allow.
Basically, Trump showed them the path they should follow with the way he treated North Korea compared to them.