Absolutely.Any attempt to access a system, device, or network without prior authorization is illegal. The only way this can be legally circumnavigated is with express wrote permission from the owner of the target. This is usually done during a penetration test. A penetration test is when a company or other entity hires an offensive security professional (also known as a pentester or white-hat hacker).The goal of the pentester is to test the security of their client by any means explicitly allowed. They are given strict parameters of what to attack and what to ignore during the pentest.So, unless you are a pentester and your client allows for brute forcing, it is 100 percent illegal. Prison time for illegally accessing a network is determined by local laws, but it is never something to strive for.