Sudan's military has said it has retaken the Republican Palace in Khartoum, the last heavily guarded bastion of rival paramilitary forces in the capital, after nearly two years of fighting.