U.S. President Donald Trump attacked the FBI, saying the agency has been unable to stop people from giving national security information to the media.