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