The government is moving to curb the rise of cheap, off-the-shelf technology being repurposed by militant groups for surveillance and targeted attacks.