Pegasus, a weapons-grade piece of software used to hack and spy on mobile phones, has been found to have potentially infected the phones of up to 50,000 people, including journalists, lawyers, opposition figures and heads of state.