I can’t think of a jurisdiction where it would not be illegal. The “I was only testing your security, in fact I should get rewarded for it” defense never works outside of nerd fantasies.
Honest citizens think like that; others wonder what the punishment is, even if it is illegal. I mean, maybe paying a fine vs maybe getting access to a popular domain?
At least corporations seem to work like that. Not following the law seems completely okay as long as the fine is not X% of their annual turnover.
So, keep it hypothetical.