No, it's not illegal at all to scan ports.