Attack on Scottish parliament’s systems came weeks after hackers tried to access email accounts at Westminster