The cost of wars in Iraq and Afghanistan was high. But it purchased us the knowledge that the idea "rifles, shotguns, and pistols will provide little resistance to a high-tech military" is absolutely, completely wrong.
It can be even said that the modern high-tech military can't win a modern guerilla war short of nuking the country, preferrably from orbit. And that is achieved in countries that are striving to become 3rd world one day in far, far future.
The highest danger to a modern high-tech army is not another high-tech army. It's an IED that may be deployed under any square foot of billions of square feet of roads. It's a sniper that with a single shot can kill anyone who is not inside a tank. It's a carefully prepared ambush on a narrow road, with mines in places where you'd be likely to run after the first shots are fired. And, most importantly, the highest danger of all is the lack of moral and political support for hostilities.
Excellent!