The U.S. military discovered that an Iranian hacking group had penetrated a local government website that was to report 2020 election results and disrupted the attack before the votes were tallied, officials revealed during a conference of cybersecurity professionals.