The second amendment was not created to dispose of a hostile government. The amendment has everything to do with forming militias in a time when armies couldn't travel vast distances to protect the people. Militias were local groups who protected themselves and their neighbors.
If the government decides it wants to be "hostile" to the citizenry, there will be nothing that can be done about it. No matter what weapons the average person has, the government and it's military will always have more and bigger.

