As hackers lock up networks that power police forces and utilities, municipalities must operate with hobbled computer systems, and decide whether to pay ransoms.